aboutsummaryrefslogtreecommitdiffstats
path: root/g10/parse-packet.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2018-03-27 06:48:00 +0000
committerWerner Koch <[email protected]>2018-03-27 06:48:00 +0000
commitd4dc4245bf0221d2db4118718fc2528ecf43b97b (patch)
tree5912abc9b9ba056a882bcd933105ba4dde73c560 /g10/parse-packet.c
parentChange license of argparse.c back to LGPLv2.1 (diff)
parentagent: Make the request origin a part of the cache items. (diff)
downloadgnupg-d4dc4245bf0221d2db4118718fc2528ecf43b97b.tar.gz
gnupg-d4dc4245bf0221d2db4118718fc2528ecf43b97b.zip
Merge branch 'STABLE-BRANCH-2-2' into master
Diffstat (limited to 'g10/parse-packet.c')
-rw-r--r--g10/parse-packet.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/g10/parse-packet.c b/g10/parse-packet.c
index e3ff4321e..e933abfa0 100644
--- a/g10/parse-packet.c
+++ b/g10/parse-packet.c
@@ -971,10 +971,10 @@ skip_packet (IOBUF inp, int pkttype, unsigned long pktlen, int partial)
}
-/* Read PKTLEN bytes form INP and return them in a newly allocated
- buffer. In case of an error (including reading fewer than PKTLEN
- bytes from INP before EOF is returned), NULL is returned and an
- error message is logged. */
+/* Read PKTLEN bytes from INP and return them in a newly allocated
+ * buffer. In case of an error (including reading fewer than PKTLEN
+ * bytes from INP before EOF is returned), NULL is returned and an
+ * error message is logged. */
static void *
read_rest (IOBUF inp, size_t pktlen)
{
@@ -1741,6 +1741,8 @@ enum_sig_subpkt (const subpktarea_t * pktbuf, sigsubpkttype_t reqtype,
}
if (buflen < n)
goto too_short;
+ if (!buflen)
+ goto no_type_byte;
type = *buffer;
if (type & 0x80)
{
@@ -1815,6 +1817,13 @@ enum_sig_subpkt (const subpktarea_t * pktbuf, sigsubpkttype_t reqtype,
if (start)
*start = -1;
return NULL;
+
+ no_type_byte:
+ if (opt.verbose)
+ log_info ("type octet missing in subpacket\n");
+ if (start)
+ *start = -1;
+ return NULL;
}