22
22
23
23
#ifndef lint
24
24
static const char rcsid [] _U_ =
25
- "@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.31.2.5 2005-07-30 21:37:50 guy Exp $ (LBL)" ;
25
+ "@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.31.2.6 2005-10-17 07:59:18 guy Exp $ (LBL)" ;
26
26
#endif
27
27
28
28
#ifdef HAVE_CONFIG_H
@@ -132,6 +132,8 @@ parse_elements(struct mgmt_body_t *pbody, const u_char *p, int offset)
132
132
offset += 2 ;
133
133
if (pbody -> ssid .length <= 0 )
134
134
break ;
135
+ if (pbody -> ssid .length > 32 )
136
+ return 0 ;
135
137
if (!TTEST2 (* (p + offset ), pbody -> ssid .length ))
136
138
return 0 ;
137
139
memcpy (& pbody -> ssid .ssid , p + offset ,
@@ -146,6 +148,8 @@ parse_elements(struct mgmt_body_t *pbody, const u_char *p, int offset)
146
148
offset += 2 ;
147
149
if (pbody -> challenge .length <= 0 )
148
150
break ;
151
+ if (pbody -> challenge .length > 253 )
152
+ return 0 ;
149
153
if (!TTEST2 (* (p + offset ), pbody -> challenge .length ))
150
154
return 0 ;
151
155
memcpy (& pbody -> challenge .text , p + offset ,
@@ -160,6 +164,8 @@ parse_elements(struct mgmt_body_t *pbody, const u_char *p, int offset)
160
164
offset += 2 ;
161
165
if (pbody -> rates .length <= 0 )
162
166
break ;
167
+ if (pbody -> rates .length > 8 )
168
+ return 0 ;
163
169
if (!TTEST2 (* (p + offset ), pbody -> rates .length ))
164
170
return 0 ;
165
171
memcpy (& pbody -> rates .rate , p + offset ,
@@ -190,6 +196,8 @@ parse_elements(struct mgmt_body_t *pbody, const u_char *p, int offset)
190
196
191
197
if (pbody -> tim .length <= 3 )
192
198
break ;
199
+ if (pbody -> rates .length > 251 )
200
+ return 0 ;
193
201
if (!TTEST2 (* (p + offset ), pbody -> tim .length - 3 ))
194
202
return 0 ;
195
203
memcpy (pbody -> tim .bitmap , p + (pbody -> tim .length - 3 ),
@@ -223,7 +231,7 @@ handle_beacon(const u_char *p)
223
231
if (!TTEST2 (* p , IEEE802_11_TSTAMP_LEN + IEEE802_11_BCNINT_LEN +
224
232
IEEE802_11_CAPINFO_LEN ))
225
233
return 0 ;
226
- memcpy (& pbody .timestamp , p , 8 );
234
+ memcpy (& pbody .timestamp , p , IEEE802_11_TSTAMP_LEN );
227
235
offset += IEEE802_11_TSTAMP_LEN ;
228
236
pbody .beacon_interval = EXTRACT_LE_16BITS (p + offset );
229
237
offset += IEEE802_11_BCNINT_LEN ;
0 commit comments