Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
63d4bb7b
Commit
63d4bb7b
authored
Aug 19, 2006
by
Robert Reif
Committed by
Alexandre Julliard
Aug 21, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Fix ExpandEnvironmentStrings to not overflow UNICODE_STRING buffer size (with test).
parent
ca80c55a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
environ.c
dlls/kernel/environ.c
+5
-0
environ.c
dlls/kernel/tests/environ.c
+6
-1
No files found.
dlls/kernel/environ.c
View file @
63d4bb7b
...
...
@@ -345,6 +345,11 @@ DWORD WINAPI ExpandEnvironmentStringsW( LPCWSTR src, LPWSTR dst, DWORD len )
TRACE
(
"(%s %p %lu)
\n
"
,
debugstr_w
(
src
),
dst
,
len
);
RtlInitUnicodeString
(
&
us_src
,
src
);
/* make sure we don't overflow maximum UNICODE_STRING size */
if
(
len
>
0x7fff
)
len
=
0x7fff
;
us_dst
.
Length
=
0
;
us_dst
.
MaximumLength
=
len
*
sizeof
(
WCHAR
);
us_dst
.
Buffer
=
dst
;
...
...
dlls/kernel/tests/environ.c
View file @
63d4bb7b
...
...
@@ -213,9 +213,14 @@ static void test_GetSetEnvironmentVariableW(void)
static
void
test_ExpandEnvironmentStringsA
(
void
)
{
char
buf
[
256
],
buf1
[
256
];
char
buf
[
256
],
buf1
[
256
]
,
buf2
[
0x8000
]
;
DWORD
ret_size
,
ret_size1
;
/* test a large destination size */
strcpy
(
buf
,
"12345"
);
ret_size
=
ExpandEnvironmentStringsA
(
buf
,
buf2
,
sizeof
(
buf2
));
ok
(
!
strcmp
(
buf
,
buf2
),
"ExpandEnvironmentStrings failed %s vs %s. ret_size = %ld
\n
"
,
buf
,
buf2
,
ret_size
);
ret_size1
=
GetWindowsDirectoryA
(
buf1
,
256
);
ok
((
ret_size1
>
0
)
&&
(
ret_size1
<
256
),
"GetWindowsDirectory Failed
\n
"
);
ret_size
=
ExpandEnvironmentStringsA
(
"%SystemRoot%"
,
buf
,
sizeof
(
buf
));
...
...
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