diff options
author | Timo Schulz <twoaday@freakmail.de> | 2003-08-20 22:20:59 +0200 |
---|---|---|
committer | Timo Schulz <twoaday@freakmail.de> | 2003-08-20 22:20:59 +0200 |
commit | 4498a55dfb2d8e294f72571e339c889b5bf5f664 (patch) | |
tree | 2cd284be3ca098dcef2fd02fe4fde2ead0fea7ad /agent/pksign.c | |
parent | 2003-08-20 Marcus Brinkmann <marcus@g10code.de> (diff) | |
download | gnupg2-4498a55dfb2d8e294f72571e339c889b5bf5f664.tar.xz gnupg2-4498a55dfb2d8e294f72571e339c889b5bf5f664.zip |
2003-08-20 Timo Schulz <twoaday@freakmail.de>
* pksign.c (do_encode_md): Allocate enough space. Cast md
byte to unsigned char to prevent sign extension.
Diffstat (limited to 'agent/pksign.c')
-rw-r--r-- | agent/pksign.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/agent/pksign.c b/agent/pksign.c index 3022e79a7..200b6a2cc 100644 --- a/agent/pksign.c +++ b/agent/pksign.c @@ -39,7 +39,7 @@ do_encode_md (const byte * md, size_t mdlen, int algo, gcry_sexp_t * r_hash) char * p, tmp[16]; int i, rc; - p = xmalloc (64+mdlen); + p = xmalloc (64 + 2 * mdlen); s = gcry_md_algo_name (algo); if (s && strlen (s) < 16) { @@ -50,7 +50,7 @@ do_encode_md (const byte * md, size_t mdlen, int algo, gcry_sexp_t * r_hash) sprintf (p, "(data\n (flags pkcs1)\n (hash %s #", tmp); for (i=0; i < mdlen; i++) { - sprintf (tmp, "%02x", md[i]); + sprintf (tmp, "%02x", (byte)md[i]); strcat (p, tmp); } strcat (p, "#))\n"); |