OSDN Git Service

makeguids: initialize memory
authorBernhard M. Wiedemann <bwiedemann@suse.de>
Tue, 24 Jul 2018 07:34:21 +0000 (09:34 +0200)
committerPeter Jones <pmjones@gmail.com>
Fri, 3 Aug 2018 13:46:05 +0000 (08:46 -0500)
so that we do not write uninitialized memory into guids.bin and names.bin
which made the resulting libefivar.so.1.36 unreproducible.
See https://reproducible-builds.org/ for why this matters.

src/makeguids.c

index f84fbb8..a15356b 100644 (file)
@@ -147,6 +147,7 @@ main(int argc, char *argv[])
                outbuf = realloc(outbuf, line * sizeof (struct guidname));
                if (!outbuf)
                        err(1, "makeguids");
+               memset(outbuf + line - 1, 0, sizeof(struct guidname));
 
                char *symbol = strchr(guidstr, '\t');
                if (symbol == NULL)