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
b5083338
Commit
b5083338
authored
Sep 24, 2013
by
Piotr Caban
Committed by
Alexandre Julliard
Sep 24, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Improve error handling in wcsrtombs function.
parent
dbbe2379
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
wcs.c
dlls/msvcrt/wcs.c
+13
-3
No files found.
dlls/msvcrt/wcs.c
View file @
b5083338
...
...
@@ -407,8 +407,10 @@ static MSVCRT_size_t MSVCRT_wcsrtombs_l(char *mbstr, const MSVCRT_wchar_t **wcst
if
(
!
mbstr
)
{
tmp
=
WideCharToMultiByte
(
locinfo
->
lc_codepage
,
WC_NO_BEST_FIT_CHARS
,
*
wcstr
,
-
1
,
NULL
,
0
,
NULL
,
&
used_default
)
-
1
;
if
(
used_default
)
if
(
!
tmp
||
used_default
)
{
*
MSVCRT__errno
()
=
MSVCRT_EILSEQ
;
return
-
1
;
}
return
tmp
;
}
...
...
@@ -418,8 +420,10 @@ static MSVCRT_size_t MSVCRT_wcsrtombs_l(char *mbstr, const MSVCRT_wchar_t **wcst
size
=
WideCharToMultiByte
(
locinfo
->
lc_codepage
,
WC_NO_BEST_FIT_CHARS
,
*
wcstr
,
1
,
buf
,
3
,
NULL
,
&
used_default
);
if
(
used_default
)
if
(
!
size
||
used_default
)
{
*
MSVCRT__errno
()
=
MSVCRT_EILSEQ
;
return
-
1
;
}
if
(
tmp
+
size
>
count
)
return
tmp
;
...
...
@@ -476,6 +480,8 @@ static int MSVCRT_wcsrtombs_s_l(MSVCRT_size_t *ret, char *mbstr,
if
(
!
mbstr
&&
!
size
&&
wcstr
)
{
conv
=
MSVCRT_wcsrtombs_l
(
NULL
,
wcstr
,
0
,
locale
);
if
(
conv
==
-
1
)
return
*
MSVCRT__errno
();
if
(
ret
)
*
ret
=
conv
+
1
;
return
0
;
...
...
@@ -492,7 +498,11 @@ static int MSVCRT_wcsrtombs_s_l(MSVCRT_size_t *ret, char *mbstr,
conv
=
count
;
conv
=
MSVCRT_wcsrtombs_l
(
mbstr
,
wcstr
,
conv
,
locale
);
if
(
conv
<
size
)
if
(
conv
==
-
1
)
{
if
(
size
)
mbstr
[
0
]
=
'\0'
;
return
*
MSVCRT__errno
();
}
else
if
(
conv
<
size
)
mbstr
[
conv
++
]
=
'\0'
;
else
if
(
conv
==
size
&&
(
count
==
MSVCRT__TRUNCATE
||
mbstr
[
conv
-
1
]
==
'\0'
))
mbstr
[
conv
-
1
]
=
'\0'
;
...
...
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