diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-04-03 13:17:57 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-04-03 13:17:57 +0300 |
commit | 58b9fb501d09ade85eae216d26cf51e31bb71e9d (patch) | |
tree | 898dc99bbaee416d09c65c3f1402cb38f29f16e9 | |
parent | 2dc456a10c0dab0d0a00afb0a1d15bf96b74a0d1 (diff) | |
download | librpm-tizen-58b9fb501d09ade85eae216d26cf51e31bb71e9d.tar.gz librpm-tizen-58b9fb501d09ade85eae216d26cf51e31bb71e9d.tar.bz2 librpm-tizen-58b9fb501d09ade85eae216d26cf51e31bb71e9d.zip |
Lose the remaining static buffer from rpmVerifySignatures()
- Simple and stupid: catenate previous buffer + latest message
with rasprintf() over and over again. Not the most efficient way but hardly
matters here...
-rw-r--r-- | lib/rpmchecksig.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/rpmchecksig.c b/lib/rpmchecksig.c index 0a45e5a9f..e5b16b871 100644 --- a/lib/rpmchecksig.c +++ b/lib/rpmchecksig.c @@ -559,7 +559,7 @@ static const char *sigtagname(rpmSigTag sigtag, int upper) int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, const char * fn) { - char buf[8192], * b; + char *buf = NULL, *b; char * missingKeys, *untrustedKeys; rpmTag sigtag; rpmTagType sigtype; @@ -661,11 +661,9 @@ int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, } failed = 0; - b = buf; *b = '\0'; missingKeys = NULL; untrustedKeys = NULL; - sprintf(b, "%s:%c", fn, (rpmIsVerbose() ? '\n' : ' ') ); - b += strlen(b); + rasprintf(&buf, "%s:%c", fn, (rpmIsVerbose() ? '\n' : ' ') ); for (hi = headerInitIterator(sigh); headerNextIterator(hi, &sigtag, &sigtype, &sig, &siglen) != 0; @@ -767,8 +765,10 @@ int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, } free(result); - b = stpcpy(b, msg); + rasprintf(&b, "%s%s", buf, msg); + free(buf); free(msg); + buf = b; } hi = headerFreeIterator(hi); @@ -786,6 +786,9 @@ int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, untrustedKeys ? untrustedKeys : "", untrustedKeys ? _(")") : ""); } + free(buf); + free(missingKeys); + free(untrustedKeys); } exit: |