]> git.ipfire.org Git - people/sennis/libloc.git/commitdiff
writer: Erase the padding
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 12 Dec 2019 13:18:51 +0000 (13:18 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 12 Dec 2019 13:18:51 +0000 (13:18 +0000)
We should not leak any data from the stack into the
database and this makes debugging easier, too.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/writer.c

index cf0ae328237400da67890dcd92ccb8f810dd9b51..6cd0027d2403bef8655616f440ae86613c770303 100644 (file)
@@ -615,6 +615,10 @@ LOC_EXPORT int loc_writer_write(struct loc_writer* writer, FILE* f) {
        for (unsigned int i = 0; i < sizeof(header.signature); i++)
                header.signature[i] = '\0';
 
+       // Clear the padding
+       for (unsigned int i = 0; i < sizeof(header.padding); i++)
+               header.padding[i] = '\0';
+
        int r;
        off_t offset = 0;