summaryrefslogtreecommitdiff
path: root/lib/rpmchecksig.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2009-03-10 13:45:12 +0200
committerPanu Matilainen <pmatilai@redhat.com>2009-03-10 13:45:12 +0200
commit33a6ed91e4a26201d2dec0bf04ab025642528b13 (patch)
tree0366e15d2b3692bb41a2d2997ec95774cdc8798e /lib/rpmchecksig.c
parentde00e073c83644976127ae271c476fba46e66596 (diff)
downloadlibrpm-tizen-33a6ed91e4a26201d2dec0bf04ab025642528b13.tar.gz
librpm-tizen-33a6ed91e4a26201d2dec0bf04ab025642528b13.tar.bz2
librpm-tizen-33a6ed91e4a26201d2dec0bf04ab025642528b13.zip
Avoid rasprintf() on potentially NULL string
Diffstat (limited to 'lib/rpmchecksig.c')
-rw-r--r--lib/rpmchecksig.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/rpmchecksig.c b/lib/rpmchecksig.c
index f175791dc..28d8836e0 100644
--- a/lib/rpmchecksig.c
+++ b/lib/rpmchecksig.c
@@ -562,15 +562,15 @@ static void formatResult(rpmSigTag sigtag, rpmRC sigres, const char *result,
const char *signame = sigtagname(sigtag, (sigres != RPMRC_OK));
if (havekey && (sigres == RPMRC_NOKEY || sigres == RPMRC_NOTTRUSTED)) {
- char *keyid = NULL;
- char *idprob = NULL;
const char *tempKey = strstr(result, "ey ID");
- if (tempKey)
- keyid = strndup(tempKey + 6, 8);
- rasprintf(&idprob, " %s#%s", signame, keyid);
- rstrcat(keyprob, idprob);
- free(keyid);
- free(idprob);
+ if (tempKey) {
+ char *keyid = strndup(tempKey + 6, 8);
+ char *idprob = NULL;
+ rasprintf(&idprob, " %s#%s", signame, keyid);
+ rstrcat(keyprob, idprob);
+ free(keyid);
+ free(idprob);
+ }
}
rasprintf(&msg, (*keyprob ? "(%s) " : "%s "), signame);
}