Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
3812fd30
Commit
3812fd30
authored
Jan 13, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libwine: Fix handling of null character in vsnprintfW for %c format.
parent
eb11dee4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
string.c
libs/wine/string.c
+8
-8
No files found.
libs/wine/string.c
View file @
3812fd30
...
...
@@ -300,7 +300,7 @@ noconv:
/* format a WCHAR string according to a printf format; helper for vsnprintfW */
static
int
format_string
(
WCHAR
*
buffer
,
size_t
len
,
const
char
*
format
,
const
WCHAR
*
str
)
static
int
format_string
(
WCHAR
*
buffer
,
size_t
len
,
const
char
*
format
,
const
WCHAR
*
str
,
int
str_len
)
{
size_t
count
=
0
;
int
i
,
left_align
=
0
,
width
=
0
,
max
=
0
;
...
...
@@ -316,13 +316,14 @@ static int format_string( WCHAR *buffer, size_t len, const char *format, const W
while
(
isdigit
(
*
format
))
width
=
width
*
10
+
*
format
++
-
'0'
;
if
(
str_len
==
-
1
)
str_len
=
strlenW
(
str
);
if
(
*
format
==
'.'
)
{
format
++
;
while
(
isdigit
(
*
format
))
max
=
max
*
10
+
*
format
++
-
'0'
;
for
(
i
=
0
;
i
<
max
;
i
++
)
if
(
!
str
[
i
])
max
=
i
;
if
(
max
>
str_len
)
max
=
str_len
;
}
else
max
=
str
lenW
(
str
)
;
else
max
=
str
_len
;
if
(
*
format
==
'h'
||
*
format
==
'l'
)
format
++
;
...
...
@@ -425,7 +426,7 @@ int vsnprintfW(WCHAR *str, size_t len, const WCHAR *format, va_list valist)
*
fmta
++
=
's'
;
*
fmta
=
0
;
count
=
format_string
(
str
,
len
-
written
,
fmtbufa
,
wstr
?
wstr
:
none
);
count
=
format_string
(
str
,
len
-
written
,
fmtbufa
,
wstr
?
wstr
:
none
,
-
1
);
if
(
count
==
-
1
)
return
-
1
;
str
+=
count
;
written
+=
count
;
...
...
@@ -435,14 +436,13 @@ int vsnprintfW(WCHAR *str, size_t len, const WCHAR *format, va_list valist)
case
'c'
:
{
WCHAR
wstr
[
2
]
;
WCHAR
wstr
;
int
count
;
wstr
[
0
]
=
va_arg
(
valist
,
int
);
wstr
[
1
]
=
0
;
wstr
=
va_arg
(
valist
,
int
);
*
fmta
++
=
's'
;
*
fmta
=
0
;
count
=
format_string
(
str
,
len
-
written
,
fmtbufa
,
wstr
);
count
=
format_string
(
str
,
len
-
written
,
fmtbufa
,
&
wstr
,
1
);
if
(
count
==
-
1
)
return
-
1
;
str
+=
count
;
written
+=
count
;
...
...
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