headerGetStringArrayEntry: add missing terminator

This commit is contained in:
Silvan Calarco 2020-06-19 16:19:42 +02:00
parent 8836c8f87b
commit 6e5e4496d7

View File

@ -189,13 +189,15 @@ headerGetStringArrayEntry(Header h, const int tag, int* count)
if (headerGet(h, tag, td, HEADERGET_MINMEM) && rpmtdType(td) == RPM_STRING_ARRAY_TYPE && rpmtdCount(td) >= 1) {
*count = rpmtdCount(td);
if (*count > 0) {
st = malloc(sizeof(char*) * *count);
st = malloc(sizeof(char*) * (*count + 1));
const char* str;
rpmtdInit(td);
while ((str = rpmtdNextString(td))) {
st[i] = strdup(str);
i++;
}
// Terminator
st[i] = NULL;
rpmtdFree(td);
}
}