aboutsummaryrefslogtreecommitdiffstats
path: root/g10/parse-packet.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2025-09-26 14:27:13 +0000
committerWerner Koch <[email protected]>2025-09-26 14:27:13 +0000
commita966c2ce90802f2fa953b04e69fdc529d61b6f53 (patch)
tree7a8a1da0919d8abd3049d6d9f15ca8aeac300dba /g10/parse-packet.c
parentgpg: Rename a struct and some variables for clarity. (diff)
downloadgnupg-a966c2ce90802f2fa953b04e69fdc529d61b6f53.tar.gz
gnupg-a966c2ce90802f2fa953b04e69fdc529d61b6f53.zip
gpg: Revamp structure of PKT_symkey_enc.
* g10/packet.h (PKT_symkey_enc): Allocate the session key so that we have a fixed length for this struct. * g10/free-packet.c (free_symkey_enc): Adjust for this change * g10/parse-packet.c (parse_symkeyenc): Ditto. * g10/encrypt.c (encrypt_simple, write_symkey_enc): Ditto.
Diffstat (limited to 'g10/parse-packet.c')
-rw-r--r--g10/parse-packet.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/g10/parse-packet.c b/g10/parse-packet.c
index ac784b7fb..32ec46b6f 100644
--- a/g10/parse-packet.c
+++ b/g10/parse-packet.c
@@ -1376,8 +1376,7 @@ parse_symkeyenc (IOBUF inp, int pkttype, unsigned long pktlen,
goto leave;
}
seskeylen = pktlen - minlen;
- k = packet->pkt.symkey_enc = xmalloc_clear (sizeof *packet->pkt.symkey_enc
- + seskeylen - 1);
+ k = packet->pkt.symkey_enc = xmalloc_clear (sizeof *packet->pkt.symkey_enc);
k->version = version;
k->cipher_algo = cipher_algo;
k->aead_algo = aead_algo;
@@ -1396,6 +1395,7 @@ parse_symkeyenc (IOBUF inp, int pkttype, unsigned long pktlen,
k->seskeylen = seskeylen;
if (k->seskeylen)
{
+ k->seskey = xcalloc (1, seskeylen);
for (i = 0; i < seskeylen && pktlen; i++, pktlen--)
k->seskey[i] = iobuf_get_noeof (inp);