mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-24 02:23:27 +08:00
avoid infinite loop on len=0
This commit is contained in:
parent
42b516cd60
commit
a4a78bf5ca
@ -26,7 +26,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-cdp.c,v 1.2 2000-05-16 23:54:55 assar Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-cdp.c,v 1.3 2000-05-26 09:32:00 itojun Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -120,8 +120,11 @@ cdp_print(const u_char *p, u_int length, u_int caplen,
|
||||
default:
|
||||
printf( " unknown field type %02x, len %d", type, len );
|
||||
}
|
||||
i+=len;
|
||||
|
||||
/* avoid infinite loop */
|
||||
if (len == 0)
|
||||
break;
|
||||
i+=len;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user