Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
1dcd1fe6
Commit
1dcd1fe6
authored
Sep 14, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Validate the destination name in IShellFolder::SetNameOf.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0ecd807e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
shfldr_fs.c
dlls/shell32/shfldr_fs.c
+6
-5
No files found.
dlls/shell32/shfldr_fs.c
View file @
1dcd1fe6
...
...
@@ -883,6 +883,7 @@ static HRESULT WINAPI IShellFolder_fnSetNameOf (IShellFolder2 * iface,
DWORD
dwFlags
,
LPITEMIDLIST
*
pPidlOut
)
{
static
const
WCHAR
invalid_chars
[]
=
{
'\\'
,
'/'
,
':'
,
'*'
,
'?'
,
'"'
,
'<'
,
'>'
,
'|'
,
0
};
IGenericSFImpl
*
This
=
impl_from_IShellFolder2
(
iface
);
WCHAR
szSrc
[
MAX_PATH
+
1
],
szDest
[
MAX_PATH
+
1
];
LPWSTR
ptr
;
...
...
@@ -891,20 +892,20 @@ static HRESULT WINAPI IShellFolder_fnSetNameOf (IShellFolder2 * iface,
TRACE
(
"(%p)->(%p,pidl=%p,%s,%u,%p)
\n
"
,
This
,
hwndOwner
,
pidl
,
debugstr_w
(
lpName
),
dwFlags
,
pPidlOut
);
/* pidl has to contain a single non-empty SHITEMID */
if
(
_ILIsDesktop
(
pidl
)
||
!
_ILIsPidlSimple
(
pidl
)
||
!
_ILGetTextPointer
(
pidl
))
return
E_INVALIDARG
;
if
(
strpbrkW
(
lpName
,
invalid_chars
))
return
HRESULT_FROM_WIN32
(
ERROR_CANCELLED
);
/* build source path */
lstrcpynW
(
szSrc
,
This
->
sPathTarget
,
MAX_PATH
);
ptr
=
PathAddBackslashW
(
szSrc
);
if
(
ptr
)
_ILSimpleGetTextW
(
pidl
,
ptr
,
MAX_PATH
+
1
-
(
ptr
-
szSrc
));
/* build destination path */
if
(
dwFlags
==
SHGDN_NORMAL
||
dwFlags
&
SHGDN_INFOLDER
)
{
lstrcpynW
(
szDest
,
This
->
sPathTarget
,
MAX_PATH
);
ptr
=
PathAddBackslashW
(
szDest
);
if
(
ptr
)
lstrcpynW
(
ptr
,
lpName
,
MAX_PATH
+
1
-
(
ptr
-
szDest
));
}
else
lstrcpynW
(
szDest
,
lpName
,
MAX_PATH
);
if
(
!
(
dwFlags
&
SHGDN_FORPARSING
)
&&
SHELL_FS_HideExtension
(
szSrc
))
{
WCHAR
*
ext
=
PathFindExtensionW
(
szSrc
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment