]> git.ipfire.org Git - pakfire.git/commitdiff
key: Ensure that exported strings are terminated by NULL
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 30 Nov 2017 12:09:10 +0000 (13:09 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 30 Nov 2017 12:09:10 +0000 (13:09 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/key.c

index 5005efde3eeb2af66f0f03521fad9414f24c12e8..92126f35967161bb29d6c0fa31250641d7295c9f 100644 (file)
@@ -362,6 +362,9 @@ char* pakfire_key_export(PakfireKey key, pakfire_key_export_mode_t mode) {
        char* mem = gpgme_data_release_and_get_mem(keydata, &length);
        gpgme_release(gpgctx);
 
+       // Terminate the string
+       mem[length] = '\0';
+
        // Copy to our own string buffer
        char* buffer = pakfire_strdup(mem);