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
c54e0d93
Commit
c54e0d93
authored
Oct 19, 2022
by
Piotr Caban
Committed by
Alexandre Julliard
Oct 19, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Fix error handling in _mbslwr_s_l.
parent
25bbc7e9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
10 deletions
+7
-10
mbcs.c
dlls/msvcrt/mbcs.c
+6
-9
string.c
dlls/msvcrt/tests/string.c
+1
-1
No files found.
dlls/msvcrt/mbcs.c
View file @
c54e0d93
...
@@ -2114,15 +2114,12 @@ unsigned char* CDECL _mbslwr(unsigned char* s)
...
@@ -2114,15 +2114,12 @@ unsigned char* CDECL _mbslwr(unsigned char* s)
*/
*/
int
CDECL
_mbslwr_s_l
(
unsigned
char
*
s
,
size_t
len
,
_locale_t
locale
)
int
CDECL
_mbslwr_s_l
(
unsigned
char
*
s
,
size_t
len
,
_locale_t
locale
)
{
{
unsigned
char
*
p
=
s
;
if
(
!
s
&&
!
len
)
if
(
!
s
&&
!
len
)
{
return
0
;
return
0
;
}
if
(
!
MSVCRT_CHECK_PMT
(
s
&&
len
))
else
if
(
!
s
||
!
len
)
{
*
_errno
()
=
EINVAL
;
return
EINVAL
;
return
EINVAL
;
}
if
(
get_mbcinfo
()
->
ismbcodepage
)
if
(
get_mbcinfo
()
->
ismbcodepage
)
{
{
...
@@ -2145,12 +2142,12 @@ int CDECL _mbslwr_s_l(unsigned char* s, size_t len, _locale_t locale)
...
@@ -2145,12 +2142,12 @@ int CDECL _mbslwr_s_l(unsigned char* s, size_t len, _locale_t locale)
*
s
=
_tolower_l
(
*
s
,
locale
);
*
s
=
_tolower_l
(
*
s
,
locale
);
}
}
if
(
*
s
)
if
(
!
MSVCRT_CHECK_PMT
(
len
)
)
{
{
*
s
=
'\0'
;
*
p
=
0
;
*
_errno
()
=
EINVAL
;
return
EINVAL
;
return
EINVAL
;
}
}
*
s
=
0
;
return
0
;
return
0
;
}
}
...
...
dlls/msvcrt/tests/string.c
View file @
c54e0d93
...
@@ -2944,7 +2944,7 @@ static void test__mbslwr_s(void)
...
@@ -2944,7 +2944,7 @@ static void test__mbslwr_s(void)
memcpy
(
buffer
,
"ABCDEFGH"
,
sizeof
(
"ABCDEFGH"
));
memcpy
(
buffer
,
"ABCDEFGH"
,
sizeof
(
"ABCDEFGH"
));
errno
=
EBADF
;
errno
=
EBADF
;
ret
=
p_mbslwr_s
(
buffer
,
4
);
ret
=
p_mbslwr_s
(
buffer
,
sizeof
(
"ABCDEFGH"
)
-
1
);
ok
(
ret
==
EINVAL
,
"Expected _mbslwr_s to return EINVAL, got %d
\n
"
,
ret
);
ok
(
ret
==
EINVAL
,
"Expected _mbslwr_s to return EINVAL, got %d
\n
"
,
ret
);
ok
(
errno
==
EINVAL
,
"Expected errno to be EINVAL, got %d
\n
"
,
errno
);
ok
(
errno
==
EINVAL
,
"Expected errno to be EINVAL, got %d
\n
"
,
errno
);
...
...
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