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
f6524a9f
Commit
f6524a9f
authored
Apr 18, 2012
by
Carlo Bramini
Committed by
Alexandre Julliard
Apr 19, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shlwapi: Add NULL checks to StrCpyW and StrCatW.
parent
d4d39736
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
5 deletions
+19
-5
string.c
dlls/shlwapi/string.c
+4
-2
string.c
dlls/shlwapi/tests/string.c
+15
-3
No files found.
dlls/shlwapi/string.c
View file @
f6524a9f
...
...
@@ -477,7 +477,8 @@ LPWSTR WINAPI StrCatW(LPWSTR lpszStr, LPCWSTR lpszSrc)
{
TRACE
(
"(%s,%s)
\n
"
,
debugstr_w
(
lpszStr
),
debugstr_w
(
lpszSrc
));
strcatW
(
lpszStr
,
lpszSrc
);
if
(
lpszStr
&&
lpszSrc
)
strcatW
(
lpszStr
,
lpszSrc
);
return
lpszStr
;
}
...
...
@@ -497,7 +498,8 @@ LPWSTR WINAPI StrCpyW(LPWSTR lpszStr, LPCWSTR lpszSrc)
{
TRACE
(
"(%p,%s)
\n
"
,
lpszStr
,
debugstr_w
(
lpszSrc
));
strcpyW
(
lpszStr
,
lpszSrc
);
if
(
lpszStr
&&
lpszSrc
)
strcpyW
(
lpszStr
,
lpszSrc
);
return
lpszStr
;
}
...
...
dlls/shlwapi/tests/string.c
View file @
f6524a9f
...
...
@@ -407,16 +407,28 @@ static void test_StrCpyW(void)
WCHAR
szSrc
[
256
];
WCHAR
szBuff
[
256
];
const
StrFormatSizeResult
*
result
=
StrFormatSize_results
;
LPWSTR
lpRes
;
while
(
result
->
value
)
{
MultiByteToWideChar
(
0
,
0
,
result
->
byte_size_64
,
-
1
,
szSrc
,
sizeof
(
szSrc
)
/
sizeof
(
WCHAR
));
StrCpyW
(
szBuff
,
szSrc
);
ok
(
!
StrCmpW
(
szSrc
,
szBuff
),
"Copied string %s wrong
\n
"
,
result
->
byte_size_64
);
lpRes
=
StrCpyW
(
szBuff
,
szSrc
);
ok
(
!
StrCmpW
(
szSrc
,
szBuff
)
&&
lpRes
==
szBuff
,
"Copied string %s wrong
\n
"
,
result
->
byte_size_64
);
result
++
;
}
/* this test crashes on win2k SP4 */
/*lpRes = StrCpyW(szBuff, NULL);*/
/*ok(lpRes == szBuff, "Wrong return value: got %p expected %p\n", lpRes, szBuff);*/
/* this test crashes on win2k SP4 */
/*lpRes = StrCpyW(NULL, szSrc);*/
/*ok(lpRes == NULL, "Wrong return value: got %p expected NULL\n", lpRes);*/
/* this test crashes on win2k SP4 */
/*lpRes = StrCpyW(NULL, NULL);*/
/*ok(lpRes == NULL, "Wrong return value: got %p expected NULL\n", lpRes);*/
}
static
void
test_StrChrNW
(
void
)
...
...
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