From: Nikos Mavrogiannopoulos Date: Sun, 23 Sep 2012 17:06:00 +0000 (+0200) Subject: Corrected bug in PGP subpacket encoding X-Git-Tag: gnutls_3_1_2~13 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4366201402fcdecde2331e4d87c05141207e1027;p=thirdparty%2Fgnutls.git Corrected bug in PGP subpacket encoding --- diff --git a/lib/opencdk/new-packet.c b/lib/opencdk/new-packet.c index 9453476be6..7a7179aff1 100644 --- a/lib/opencdk/new-packet.c +++ b/lib/opencdk/new-packet.c @@ -711,8 +711,9 @@ _cdk_subpkt_get_array (cdk_subpkt_t s, int count, size_t * r_nbytes) buf[n++] = nbytes; else if (nbytes < 8384) { + nbytes -= 192; buf[n++] = nbytes / 256 + 192; - buf[n++] = nbytes % 256; + buf[n++] = nbytes & 0xff; } else { @@ -722,6 +723,7 @@ _cdk_subpkt_get_array (cdk_subpkt_t s, int count, size_t * r_nbytes) buf[n++] = nbytes >> 8; buf[n++] = nbytes; } + buf[n++] = list->type; memcpy (buf + n, list->d, list->size); n += list->size;