Commit 6e5e4496d7a87f014e6d281639d60222aa45d42a

Authored by Silvan Calarco
1 parent 8836c8f87b
Exists in master

headerGetStringArrayEntry: add missing terminator

Showing 1 changed file with 3 additions and 1 deletions Side-by-side Diff

... ... @@ -189,13 +189,15 @@
189 189 if (headerGet(h, tag, td, HEADERGET_MINMEM) && rpmtdType(td) == RPM_STRING_ARRAY_TYPE && rpmtdCount(td) >= 1) {
190 190 *count = rpmtdCount(td);
191 191 if (*count > 0) {
192   - st = malloc(sizeof(char*) * *count);
  192 + st = malloc(sizeof(char*) * (*count + 1));
193 193 const char* str;
194 194 rpmtdInit(td);
195 195 while ((str = rpmtdNextString(td))) {
196 196 st[i] = strdup(str);
197 197 i++;
198 198 }
  199 + // Terminator
  200 + st[i] = NULL;
199 201 rpmtdFree(td);
200 202 }
201 203 }