Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Simon Ruderich
passt-mac
Commits
ff679414
Commit
ff679414
authored
Aug 19, 2016
by
Simon Ruderich
Browse files
slsm: tree: fix incorrect usage of va_start()/va_end()
parent
50126302
Changes
1
Hide whitespace changes
Inline
Side-by-side
security/slsm/tree.c
View file @
ff679414
...
...
@@ -198,11 +198,16 @@ int slsm_str_append(struct slsm_str *buf, const char *fmt, ...) {
va_list
args
;
int
written
;
va_start
(
args
,
fmt
);
while
((
written
=
vsnprintf
(
buf
->
buf
+
buf
->
used
,
buf
->
size
-
buf
->
used
,
fmt
,
args
)
+
1
)
>
buf
->
size
-
buf
->
used
)
{
while
(
1
)
{
char
*
new_buf
;
size_t
new_size
=
buf
->
size
*
2
;
va_start
(
args
,
fmt
);
// must call va_start per loop iteration
written
=
vsnprintf
(
buf
->
buf
+
buf
->
used
,
buf
->
size
-
buf
->
used
,
fmt
,
args
)
+
1
;
if
(
written
<=
buf
->
size
-
buf
->
used
)
break
;
va_end
(
args
);
if
(
new_size
>
(
ssize_t
)
new_size
)
return
-
EFBIG
;
...
...
@@ -213,7 +218,6 @@ int slsm_str_append(struct slsm_str *buf, const char *fmt, ...) {
buf
->
buf
=
new_buf
;
buf
->
size
=
new_size
;
}
va_end
(
args
);
buf
->
used
+=
(
size_t
)
written
;
...
...
Write
Preview
Supports
Markdown
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