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
92b4979b
Commit
92b4979b
authored
May 16, 2012
by
Alex Henrie
Committed by
Alexandre Julliard
May 17, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Avoid calling MultiByteToWideChar with invalid parameters.
parent
eeee536a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
20 deletions
+37
-20
locale.c
dlls/kernel32/locale.c
+37
-20
No files found.
dlls/kernel32/locale.c
View file @
92b4979b
...
...
@@ -2867,34 +2867,51 @@ INT WINAPI CompareStringA(LCID lcid, DWORD style,
if
(
!
(
style
&
LOCALE_USE_CP_ACP
))
locale_cp
=
get_lcid_codepage
(
lcid
);
len1W
=
MultiByteToWideChar
(
locale_cp
,
0
,
str1
,
len1
,
buf1W
,
130
);
if
(
len1W
)
str1W
=
buf1W
;
else
if
(
len1
)
{
len1W
=
MultiByteToWideChar
(
locale_cp
,
0
,
str1
,
len1
,
NULL
,
0
);
str1W
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len1W
*
sizeof
(
WCHAR
));
if
(
!
str1W
)
len1W
=
MultiByteToWideChar
(
locale_cp
,
0
,
str1
,
len1
,
buf1W
,
130
);
if
(
len1W
)
str1W
=
buf1W
;
else
{
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
return
0
;
len1W
=
MultiByteToWideChar
(
locale_cp
,
0
,
str1
,
len1
,
NULL
,
0
);
str1W
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len1W
*
sizeof
(
WCHAR
));
if
(
!
str1W
)
{
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
return
0
;
}
MultiByteToWideChar
(
locale_cp
,
0
,
str1
,
len1
,
str1W
,
len1W
);
}
MultiByteToWideChar
(
locale_cp
,
0
,
str1
,
len1
,
str1W
,
len1W
);
}
len2W
=
MultiByteToWideChar
(
locale_cp
,
0
,
str2
,
len2
,
buf2W
,
130
);
if
(
len2W
)
str2W
=
buf2W
;
else
{
len2W
=
MultiByteToWideChar
(
locale_cp
,
0
,
str2
,
len2
,
NULL
,
0
);
str2W
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len2W
*
sizeof
(
WCHAR
));
if
(
!
str2W
)
len1W
=
0
;
str1W
=
buf1W
;
}
if
(
len2
)
{
len2W
=
MultiByteToWideChar
(
locale_cp
,
0
,
str2
,
len2
,
buf2W
,
130
);
if
(
len2W
)
str2W
=
buf2W
;
else
{
if
(
str1W
!=
buf1W
)
HeapFree
(
GetProcessHeap
(),
0
,
str1W
);
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
return
0
;
len2W
=
MultiByteToWideChar
(
locale_cp
,
0
,
str2
,
len2
,
NULL
,
0
);
str2W
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len2W
*
sizeof
(
WCHAR
));
if
(
!
str2W
)
{
if
(
str1W
!=
buf1W
)
HeapFree
(
GetProcessHeap
(),
0
,
str1W
);
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
return
0
;
}
MultiByteToWideChar
(
locale_cp
,
0
,
str2
,
len2
,
str2W
,
len2W
);
}
MultiByteToWideChar
(
locale_cp
,
0
,
str2
,
len2
,
str2W
,
len2W
);
}
else
{
len2W
=
0
;
str2W
=
buf2W
;
}
ret
=
CompareStringW
(
lcid
,
style
,
str1W
,
len1W
,
str2W
,
len2W
);
...
...
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