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
94d2b474
Commit
94d2b474
authored
Dec 03, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Fix assumptions about 0-size output buffer in ntdll Unicode conversion functions.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5536df1e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
12 deletions
+28
-12
file.c
dlls/kernelbase/file.c
+18
-3
registry.c
dlls/kernelbase/registry.c
+9
-7
string.c
dlls/kernelbase/string.c
+1
-2
No files found.
dlls/kernelbase/file.c
View file @
94d2b474
...
...
@@ -292,10 +292,25 @@ DWORD file_name_WtoA( LPCWSTR src, INT srclen, LPSTR dest, INT destlen )
DWORD
ret
;
if
(
srclen
<
0
)
srclen
=
lstrlenW
(
src
)
+
1
;
if
(
oem_file_apis
)
RtlUnicodeToOemN
(
dest
,
destlen
,
&
ret
,
src
,
srclen
*
sizeof
(
WCHAR
)
);
if
(
!
destlen
)
{
if
(
oem_file_apis
)
{
UNICODE_STRING
strW
;
strW
.
Buffer
=
(
WCHAR
*
)
src
;
strW
.
Length
=
srclen
*
sizeof
(
WCHAR
);
ret
=
RtlUnicodeStringToOemSize
(
&
strW
)
-
1
;
}
else
RtlUnicodeToMultiByteSize
(
&
ret
,
src
,
srclen
*
sizeof
(
WCHAR
)
);
}
else
RtlUnicodeToMultiByteN
(
dest
,
destlen
,
&
ret
,
src
,
srclen
*
sizeof
(
WCHAR
)
);
{
if
(
oem_file_apis
)
RtlUnicodeToOemN
(
dest
,
destlen
,
&
ret
,
src
,
srclen
*
sizeof
(
WCHAR
)
);
else
RtlUnicodeToMultiByteN
(
dest
,
destlen
,
&
ret
,
src
,
srclen
*
sizeof
(
WCHAR
)
);
}
return
ret
;
}
...
...
dlls/kernelbase/registry.c
View file @
94d2b474
...
...
@@ -915,7 +915,7 @@ LSTATUS WINAPI RegQueryInfoKeyA( HKEY hkey, LPSTR class, LPDWORD class_len, LPDW
NTSTATUS
status
;
char
buffer
[
256
],
*
buf_ptr
=
buffer
;
KEY_FULL_INFORMATION
*
info
=
(
KEY_FULL_INFORMATION
*
)
buffer
;
DWORD
total_size
,
len
;
DWORD
total_size
;
TRACE
(
"(%p,%p,%d,%p,%p,%p,%p,%p,%p,%p,%p)
\n
"
,
hkey
,
class
,
class_len
?
*
class_len
:
0
,
reserved
,
subkeys
,
max_subkey
,
values
,
max_value
,
max_data
,
security
,
modif
);
...
...
@@ -940,19 +940,21 @@ LSTATUS WINAPI RegQueryInfoKeyA( HKEY hkey, LPSTR class, LPDWORD class_len, LPDW
if
(
status
)
goto
done
;
len
=
0
;
if
(
class
&&
class_len
)
len
=
*
class_len
;
RtlUnicodeToMultiByteN
(
class
,
len
,
class_len
,
(
WCHAR
*
)(
buf_ptr
+
info
->
ClassOffset
),
info
->
ClassLength
);
if
(
len
)
if
(
class
&&
class_len
&&
*
class_len
)
{
if
(
*
class_len
+
1
>
len
)
DWORD
len
=
*
class_len
;
RtlUnicodeToMultiByteN
(
class
,
len
,
class_len
,
(
WCHAR
*
)(
buf_ptr
+
info
->
ClassOffset
),
info
->
ClassLength
);
if
(
*
class_len
==
len
)
{
status
=
STATUS_BUFFER_OVERFLOW
;
*
class_len
-=
1
;
}
class
[
*
class_len
]
=
0
;
}
else
if
(
class_len
)
RtlUnicodeToMultiByteSize
(
class_len
,
(
WCHAR
*
)(
buf_ptr
+
info
->
ClassOffset
),
info
->
ClassLength
);
}
else
status
=
STATUS_SUCCESS
;
...
...
dlls/kernelbase/string.c
View file @
94d2b474
...
...
@@ -1382,8 +1382,7 @@ INT WINAPI DECLSPEC_HOTPATCH LoadStringA(HINSTANCE instance, UINT resource_id, L
while
(
id
--
)
p
+=
*
p
+
1
;
if
(
buflen
!=
1
)
RtlUnicodeToMultiByteN
(
buffer
,
buflen
-
1
,
&
retval
,
p
+
1
,
*
p
*
sizeof
(
WCHAR
));
RtlUnicodeToMultiByteN
(
buffer
,
buflen
-
1
,
&
retval
,
p
+
1
,
*
p
*
sizeof
(
WCHAR
));
}
buffer
[
retval
]
=
0
;
TRACE
(
"returning %s
\n
"
,
debugstr_a
(
buffer
));
...
...
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