]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Corrected bug in PGP subpacket encoding
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Sun, 23 Sep 2012 17:06:00 +0000 (19:06 +0200)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Sun, 23 Sep 2012 17:06:00 +0000 (19:06 +0200)
lib/opencdk/new-packet.c

index 9453476be6cdc6d91fd6a7f3b357c5e1ce9baa48..7a7179aff1b185a04d1264f8a326998074bd1f34 100644 (file)
@@ -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;