]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
Terminate strv with NULL
authorLucas De Marchi <lucas.demarchi@profusion.mobi>
Tue, 20 Dec 2011 05:09:58 +0000 (03:09 -0200)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Tue, 20 Dec 2011 05:27:50 +0000 (03:27 -0200)
libkmod/libkmod-elf.c

index 44381203815a37dada5e04084216ae1879bd2816..7bd73fcbd842c936a0fce02224104e639e49ff63 100644 (file)
@@ -433,10 +433,11 @@ int kmod_elf_get_strings(const struct kmod_elf *elf, const char *section, char *
        if (strings[i - 1] != '\0')
                count++;
 
-       *array = a = malloc(size + 1 + sizeof(char *) * count);
+       *array = a = malloc(size + 1 + sizeof(char *) * (count + 1));
        if (*array == NULL)
                return -errno;
 
+       a[count] = NULL;
        itr = (char *)(a + count);
        last = 0;
        for (i = 0, count = 0; i < size; i++) {