Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Ferrillo
wine
Commits
3812fd30
Commit
3812fd30
authored
14 years ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
libwine: Fix handling of null character in vsnprintfW for %c format.
parent
eb11dee4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libs/wine/string.c
+8
-8
8 additions, 8 deletions
libs/wine/string.c
with
8 additions
and
8 deletions
libs/wine/string.c
+
8
−
8
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
=
strlen
W
(
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
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment