Permalink
Browse files

Fix sigsegv in stringFormat() (rhbz:1316903)

Just skip duping of NULL and return it. Returned NULL is handled in
upper layer.
  • Loading branch information...
lkardos committed Apr 25, 2016
1 parent b722cf8 commit cddf43a56f19711866371f02f378dc4095b0fadd
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/formats.c
View
@@ -44,9 +44,12 @@ static char * stringFormat(rpmtd td)
case RPM_NUMERIC_CLASS:
rasprintf(&val, "%" PRIu64, rpmtdGetNumber(td));
break;
case RPM_STRING_CLASS:
val = xstrdup(rpmtdGetString(td));
case RPM_STRING_CLASS: {
const char *str = rpmtdGetString(td);
if (str)
val = xstrdup(str);
break;
}
case RPM_BINARY_CLASS:
val = pgpHexStr(td->data, td->count);
break;

0 comments on commit cddf43a

Please sign in to comment.