aboutsummaryrefslogtreecommitdiffstats
path: root/g10/parse-packet.c
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2004-10-16 22:48:20 +0000
committerDavid Shaw <[email protected]>2004-10-16 22:48:20 +0000
commitb03a7a6f3bf93c00e46d90b6cca450e39bb0bb72 (patch)
treebdea411a99448240221880c9ff3d1387e0bbd22f /g10/parse-packet.c
parent* http.c (connect_server): [_WIN32] actually fill in the sin_addr so we (diff)
downloadgnupg-b03a7a6f3bf93c00e46d90b6cca450e39bb0bb72.tar.gz
gnupg-b03a7a6f3bf93c00e46d90b6cca450e39bb0bb72.zip
* parse-packet.c (parse_one_sig_subpkt, enum_sig_subpkt): Don't BUG() on
unknown subpackets. Rather, just return them silently.
Diffstat (limited to 'g10/parse-packet.c')
-rw-r--r--g10/parse-packet.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/g10/parse-packet.c b/g10/parse-packet.c
index 48035ad5d..eeb75ac89 100644
--- a/g10/parse-packet.c
+++ b/g10/parse-packet.c
@@ -955,10 +955,9 @@ dump_sig_subpkt( int hashed, int type, int critical,
}
/****************
- * Returns: >= 0 offset into buffer
- * -1 unknown type
- * -2 unsupported type
- * -3 subpacket too short
+ * Returns: >= 0 use this offset into buffer
+ * -1 explicitly reject returning this type
+ * -2 subpacket too short
*/
int
parse_one_sig_subpkt( const byte *buffer, size_t n, int type )
@@ -1008,9 +1007,9 @@ parse_one_sig_subpkt( const byte *buffer, size_t n, int type )
if ( n != 2 )
break;
return 0;
- default: return -1;
+ default: return 0;
}
- return -3;
+ return -2;
}
@@ -1130,13 +1129,11 @@ enum_sig_subpkt( const subpktarea_t *pktbuf, sigsubpkttype_t reqtype,
*ret_n = n;
offset = parse_one_sig_subpkt(buffer, n, type );
switch( offset ) {
- case -3:
- log_error("subpacket of type %d too short\n", type);
- return NULL;
case -2:
+ log_error("subpacket of type %d too short\n", type);
return NULL;
case -1:
- BUG(); /* not yet needed */
+ return NULL;
default:
break;
}