summaryrefslogtreecommitdiffstats
path: root/contrib/tcpdump/print-atm.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/tcpdump/print-atm.c')
-rw-r--r--contrib/tcpdump/print-atm.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/contrib/tcpdump/print-atm.c b/contrib/tcpdump/print-atm.c
index b352579..1676a86 100644
--- a/contrib/tcpdump/print-atm.c
+++ b/contrib/tcpdump/print-atm.c
@@ -167,7 +167,7 @@ atm_if_print(netdissect_options *ndo,
uint32_t llchdr;
u_int hdrlen = 0;
- if (caplen < 8) {
+ if (caplen < 1 || length < 1) {
ND_PRINT((ndo, "%s", tstr));
return (caplen);
}
@@ -181,6 +181,15 @@ atm_if_print(netdissect_options *ndo,
}
/*
+ * Must have at least a DSAP, an SSAP, and the first byte of the
+ * control field.
+ */
+ if (caplen < 3 || length < 3) {
+ ND_PRINT((ndo, "%s", tstr));
+ return (caplen);
+ }
+
+ /*
* Extract the presumed LLC header into a variable, for quick
* testing.
* Then check for a header that's neither a header for a SNAP
@@ -207,6 +216,10 @@ atm_if_print(netdissect_options *ndo,
* packets? If so, could it be changed to use a
* new DLT_IEEE802_6 value if we added it?
*/
+ if (caplen < 20 || length < 20) {
+ ND_PRINT((ndo, "%s", tstr));
+ return (caplen);
+ }
if (ndo->ndo_eflag)
ND_PRINT((ndo, "%08x%08x %08x%08x ",
EXTRACT_32BITS(p),
OpenPOWER on IntegriCloud