aboutsummaryrefslogtreecommitdiffstats
path: root/g10/keygen.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2016-07-01 13:18:59 +0000
committerWerner Koch <[email protected]>2016-07-01 14:27:43 +0000
commitd8bce478be3ae9e401841a77d189ef3c81ccb757 (patch)
tree20cc4a72bd223e514c19a7f3c55bab0ab7eaf24d /g10/keygen.c
parentcommon: Add function to select records etc. (diff)
downloadgnupg-d8bce478be3ae9e401841a77d189ef3c81ccb757.tar.gz
gnupg-d8bce478be3ae9e401841a77d189ef3c81ccb757.zip
gpg: Make sure a user ID packet has always a terminating Nul in memory.
* g10/keygen.c (write_uid): Avoid overflow. -- Also the actual length if the user ID is given by LEN, using NAME diretcly is often more convenient.
Diffstat (limited to '')
-rw-r--r--g10/keygen.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/g10/keygen.c b/g10/keygen.c
index 3a9a8e7cb..2b3d32886 100644
--- a/g10/keygen.c
+++ b/g10/keygen.c
@@ -202,7 +202,7 @@ write_uid( KBNODE root, const char *s )
size_t n = strlen(s);
pkt->pkttype = PKT_USER_ID;
- pkt->pkt.user_id = xmalloc_clear( sizeof *pkt->pkt.user_id + n - 1 );
+ pkt->pkt.user_id = xmalloc_clear (sizeof *pkt->pkt.user_id + n);
pkt->pkt.user_id->len = n;
pkt->pkt.user_id->ref = 1;
strcpy(pkt->pkt.user_id->name, s);