1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

Check for garbled packets

This commit is contained in:
Werner Koch 2001-09-18 09:40:31 +00:00
parent 6c09d0f462
commit e46ad749f9
9 changed files with 155 additions and 28 deletions

View file

@ -368,6 +368,14 @@ parse( IOBUF inp, PACKET *pkt, int onlykeypkts, off_t *retpos,
}
}
if (pktlen == 0xffffffff) {
/* with a some probability this is caused by a problem in the
* the uncompressing layer - in some error cases it just loops
* and spits out 0xff bytes. */
log_error ("%s: garbled packet detected\n", iobuf_where(inp) );
g10_exit (2);
}
if( out && pkttype ) {
if( iobuf_write( out, hdr, hdrlen ) == -1 )
rc = G10ERR_WRITE_FILE;
@ -766,7 +774,8 @@ dump_sig_subpkt( int hashed, int type, int critical,
p = "regular expression";
break;
case SIGSUBPKT_REVOCABLE:
p = "revocable";
if( length )
printf("%srevocable", *buffer? "":"not ");
break;
case SIGSUBPKT_KEY_EXPIRE:
if( length >= 4 )
@ -829,7 +838,9 @@ dump_sig_subpkt( int hashed, int type, int critical,
printf(" %d", buffer[i] );
break;
case SIGSUBPKT_KS_FLAGS:
p = "key server preferences";
fputs("key server preferences:",stdout);
for(i=0;i<length;i++)
printf(" %02X", buffer[i]);
break;
case SIGSUBPKT_PREF_KS:
p = "preferred key server";