Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
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
Aleksandr Isakov
wine-fonts
Commits
49fcd632
Commit
49fcd632
authored
Jul 08, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Disallow relative paths in wine_unix_to_nt_file_name(), handle them in the caller.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3aa4feb5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
17 deletions
+18
-17
path.c
dlls/kernel32/path.c
+16
-2
path.c
dlls/ntdll/path.c
+2
-15
No files found.
dlls/kernel32/path.c
View file @
49fcd632
...
...
@@ -301,10 +301,24 @@ WCHAR * CDECL wine_get_dos_file_name( LPCSTR str )
{
UNICODE_STRING
nt_name
;
ANSI_STRING
unix_name
;
NTSTATUS
status
;
WCHAR
*
buffer
;
DWORD
len
;
RtlInitAnsiString
(
&
unix_name
,
str
);
if
(
!
set_ntstatus
(
wine_unix_to_nt_file_name
(
&
unix_name
,
&
nt_name
)))
return
NULL
;
if
(
str
[
0
]
!=
'/'
)
/* relative path name */
{
len
=
strlen
(
str
)
+
1
;
if
(
!
(
buffer
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
)))
return
NULL
;
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
str
,
len
,
buffer
,
len
);
status
=
RtlDosPathNameToNtPathName_U_WithStatus
(
buffer
,
&
nt_name
,
NULL
,
NULL
);
RtlFreeHeap
(
GetProcessHeap
(),
0
,
buffer
);
}
else
{
RtlInitAnsiString
(
&
unix_name
,
str
);
status
=
wine_unix_to_nt_file_name
(
&
unix_name
,
&
nt_name
);
}
if
(
!
set_ntstatus
(
status
))
return
NULL
;
if
(
nt_name
.
Buffer
[
5
]
==
':'
)
{
/* get rid of the \??\ prefix */
...
...
dlls/ntdll/path.c
View file @
49fcd632
...
...
@@ -891,23 +891,10 @@ NTSTATUS WINAPI RtlSetCurrentDirectory_U(const UNICODE_STRING* dir)
*/
NTSTATUS
CDECL
wine_unix_to_nt_file_name
(
const
ANSI_STRING
*
name
,
UNICODE_STRING
*
nt
)
{
unsigned
int
len
W
,
len
A
=
name
->
Length
;
unsigned
int
lenA
=
name
->
Length
;
const
char
*
path
=
name
->
Buffer
;
if
(
!
lenA
)
return
STATUS_INVALID_PARAMETER
;
if
(
path
[
0
]
!=
'/'
)
/* relative path name */
{
WCHAR
*
tmp
;
NTSTATUS
status
;
if
(
!
(
tmp
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
(
lenA
+
1
)
*
sizeof
(
WCHAR
)
)))
return
STATUS_NO_MEMORY
;
lenW
=
ntdll_umbstowcs
(
path
,
lenA
,
tmp
,
lenA
);
tmp
[
lenW
]
=
0
;
status
=
RtlDosPathNameToNtPathName_U_WithStatus
(
tmp
,
nt
,
NULL
,
NULL
);
RtlFreeHeap
(
GetProcessHeap
(),
0
,
tmp
);
return
status
;
}
if
(
path
[
0
]
!=
'/'
)
return
STATUS_INVALID_PARAMETER
;
/* relative path not supported */
return
unix_funcs
->
unix_to_nt_file_name
(
name
,
nt
);
}
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