in static dl_iterate_phdr, fix use of possibly-uninitialized aux data
authorRich Felker <dalias@aerifal.cx>
Tue, 14 Mar 2017 18:29:50 +0000 (14:29 -0400)
committerRich Felker <dalias@aerifal.cx>
Tue, 14 Mar 2017 18:29:50 +0000 (14:29 -0400)
this could only happen if an incomplete auxv was passed into the
program, but it's better to just initialize the data anyway.

src/ldso/dl_iterate_phdr.c

index c141fd9b4f27ff4f3315c848cdb4aeeffe251720..e55cbf765796457ab8da257c9e838ca5d9ff78f2 100644 (file)
@@ -11,7 +11,7 @@ static int static_dl_iterate_phdr(int(*callback)(struct dl_phdr_info *info, size
        size_t base = 0;
        size_t n;
        struct dl_phdr_info info;
-       size_t i, aux[AUX_CNT];
+       size_t i, aux[AUX_CNT] = {0};
 
        for (i=0; libc.auxv[i]; i+=2)
                if (libc.auxv[i]<AUX_CNT) aux[libc.auxv[i]] = libc.auxv[i+1];