pgpDig dig = pgpNewDig();
pgpDigParams sigp = &dig->signature;
size_t nb = 0;
- const char *tempstr;
+ char *tempstr = NULL;
(void) pgpPrtPkts(pkt, pktlen, dig, 0);
if (t + strlen (tempstr) > val + nb)
goto again;
t = stpcpy(t, tempstr);
+ free(tempstr);
dig = pgpFreeDig(dig);
}
/* If same signer, skip resigning the package. */
if (!memcmp(oldsignid, newsignid, sizeof(oldsignid))) {
+ char *signid = pgpHexStr(newsignid+4, sizeof(newsignid)-4);
rpmlog(RPMLOG_WARNING,
_("%s: was already signed by key ID %s, skipping\n"),
- rpm, pgpHexStr(newsignid+4, sizeof(newsignid)-4));
+ rpm, signid);
+ free(signid);
/* Clean up intermediate target */
xx = unlink(sigtarget);
|| pubp->userid == NULL)
goto exit;
- v = t = xmalloc(16+1);
- t = stpcpy(t, pgpHexStr(pubp->signid, sizeof(pubp->signid)));
+ v = pgpHexStr(pubp->signid, sizeof(pubp->signid));
- r = t = xmalloc(8+1);
- t = stpcpy(t, pgpHexStr(pubp->time, sizeof(pubp->time)));
+ t = pgpHexStr(pubp->time, sizeof(pubp->time));
n = t = xmalloc(sizeof("gpg()")+8);
t = stpcpy( stpcpy( stpcpy(t, "gpg("), v+8), ")");
static void pgpPrtHex(const char *pre, const uint8_t *p, size_t plen)
{
+ char *hex = NULL;
if (!_print) return;
if (pre && *pre)
fprintf(stderr, "%s", pre);
- fprintf(stderr, " %s", pgpHexStr(p, plen));
+ hex = pgpHexStr(p, plen);
+ fprintf(stderr, " %s", hex);
+ free(hex);
}
void pgpPrtVal(const char * pre, pgpValTbl vs, uint8_t val)
};
#endif
+char * pgpHexStr(const uint8_t *p, size_t plen)
+{
+ char *t = xmalloc(plen * 2 + 1);
+ pgpHexCvt(t, p, plen);
+ return t;
+}
+
static const uint8_t * pgpPrtPubkeyParams(uint8_t pubkey_algo,
const uint8_t *p, const uint8_t *h, size_t hlen)
{
/** \ingroup rpmpgp
* Return hex formatted representation of bytes.
- * @todo Remove static buffer.
* @param p bytes
* @param plen no. of bytes
- * @return hex formatted string
+ * @return hex formatted string (malloc'ed)
*/
-static inline
-const char * pgpHexStr(const uint8_t *p, size_t plen)
-{
- static char prbuf[8*BUFSIZ]; /* XXX ick */
- char *t = prbuf;
- t = pgpHexCvt(t, p, plen);
- return prbuf;
-}
+char * pgpHexStr(const uint8_t *p, size_t plen);
/** \ingroup rpmpgp
* Return hex formatted representation of a multiprecision integer.