X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/19273089fc525d27b4d67fbe287ba31633f5b88e..ffa1470e5c7ff0e50028d085a481dc797b0b51ed:/print-802_11.c?ds=sidebyside diff --git a/print-802_11.c b/print-802_11.c index 6f7818bc..891439e0 100644 --- a/print-802_11.c +++ b/print-802_11.c @@ -22,7 +22,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.31.2.7 2005-11-13 12:07:44 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.31.2.10 2005-11-13 20:23:09 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -167,7 +167,7 @@ parse_elements(struct mgmt_body_t *pbody, const u_char *p, int offset) for (;;) { if (!TTEST2(*(p + offset), 1)) - return 1; + return; switch (*(p + offset)) { case E_SSID: /* Present, possibly truncated */ @@ -177,7 +177,8 @@ parse_elements(struct mgmt_body_t *pbody, const u_char *p, int offset) memcpy(&pbody->ssid, p + offset, 2); offset += 2; if (pbody->ssid.length != 0) { - if (pbody->ssid.length > 32) + if (pbody->ssid.length > + sizeof(pbody->ssid.ssid) - 1) return; if (!TTEST2(*(p + offset), pbody->ssid.length)) return; @@ -196,8 +197,9 @@ parse_elements(struct mgmt_body_t *pbody, const u_char *p, int offset) return; memcpy(&pbody->challenge, p + offset, 2); offset += 2; - if (pbody->challenge.length == 0) { - if (pbody->challenge.length > 253) + if (pbody->challenge.length != 0) { + if (pbody->challenge.length > + sizeof(pbody->challenge.text) - 1) return; if (!TTEST2(*(p + offset), pbody->challenge.length)) return; @@ -262,7 +264,7 @@ parse_elements(struct mgmt_body_t *pbody, const u_char *p, int offset) if (pbody->tim.length <= 3) break; - if (pbody->rates.length > 251) + if (pbody->rates.length > sizeof pbody->tim.bitmap) return; if (!TTEST2(*(p + offset), pbody->tim.length - 3)) return;