Fix pointer dereference before testing for NULL in rpmtdGetNumber()

This commit is contained in:
Panu Matilainen 2020-02-06 14:51:14 +02:00 committed by Florian Festi
parent 8b1ea52de3
commit c886b359ba
1 changed files with 3 additions and 3 deletions

View File

@ -210,12 +210,12 @@ const char * rpmtdGetString(rpmtd td)
uint64_t rpmtdGetNumber(rpmtd td)
{
uint64_t val = 0;
int ix = (td->ix >= 0 ? td->ix : 0);
if (td == NULL)
return 0;
uint64_t val = 0;
int ix = (td->ix >= 0 ? td->ix : 0);
switch (td->type) {
case RPM_INT64_TYPE:
val = *((uint64_t *) td->data + ix);