summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2012-09-23 19:06:00 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2012-09-23 19:06:00 +0200
commit4366201402fcdecde2331e4d87c05141207e1027 (patch)
treeb920d27252c2e9deb7948b896a319e48b6545290
parenta3887dabf27995374a52bc4fd0bd4da10d9081ad (diff)
downloadgnutls-4366201402fcdecde2331e4d87c05141207e1027.tar.gz
Corrected bug in PGP subpacket encoding
-rw-r--r--lib/opencdk/new-packet.c4
1 files changed, 3 insertions, 1 deletions
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;