mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-10 20:00:27 +00:00
vcscanf: ensure buf is NULL after string decoding
The presence of a pointer in buf could result in double free bugs when execution reaches the end of the function and it is freed.
This commit is contained in:
parent
758cdb72da
commit
90f19ed448
1 changed files with 1 additions and 0 deletions
|
@ -540,6 +540,7 @@ int __vcscanf(int callback(void *), //
|
||||||
if (ismalloc) {
|
if (ismalloc) {
|
||||||
*va_arg(va, char **) = (void *) buf;
|
*va_arg(va, char **) = (void *) buf;
|
||||||
}
|
}
|
||||||
|
buf = NULL;
|
||||||
} else {
|
} else {
|
||||||
do {
|
do {
|
||||||
if (isspace(c)) break;
|
if (isspace(c)) break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue