diff options
author | Lucas De Marchi <lucas.demarchi@profusion.mobi> | 2011-12-20 03:09:58 -0200 |
---|---|---|
committer | Lucas De Marchi <lucas.demarchi@profusion.mobi> | 2011-12-20 03:27:50 -0200 |
commit | 3267026e0b18e25a754b7c71956256bd6232258b (patch) | |
tree | 853b655dd9bdb30536fb7d7d445ae0265bd81648 /libkmod/libkmod-elf.c | |
parent | 4f0f0e75e2fefc2eb26da81f7a4fadf5d624875f (diff) | |
download | kmod-3267026e0b18e25a754b7c71956256bd6232258b.tar.gz |
Terminate strv with NULL
Diffstat (limited to 'libkmod/libkmod-elf.c')
-rw-r--r-- | libkmod/libkmod-elf.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libkmod/libkmod-elf.c b/libkmod/libkmod-elf.c index 4438120..7bd73fc 100644 --- a/libkmod/libkmod-elf.c +++ b/libkmod/libkmod-elf.c @@ -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++) { |