vfscanf: fix possible invalid free due to uninitialized variable use
authorJulien Ramseier <j.ramseier@gmail.com>
Wed, 1 Jul 2020 13:12:14 +0000 (15:12 +0200)
committerRich Felker <dalias@aerifal.cx>
Thu, 2 Jul 2020 15:25:44 +0000 (11:25 -0400)
vfscanf() may use the variable 'alloc' uninitialized when taking the
branch introduced by commit b287cd745c2243f8e5114331763a5a9813b5f6ee.
Spotted by clang.

src/stdio/vfscanf.c

index b5ebc16..b78a374 100644 (file)
@@ -57,7 +57,7 @@ int vfscanf(FILE *restrict f, const char *restrict fmt, va_list ap)
 {
        int width;
        int size;
-       int alloc;
+       int alloc = 0;
        int base;
        const unsigned char *p;
        int c, t;