Skip to content

Commit 36fded6

Browse files
committed
802.11: make the length in the IE structures a u_int.
This avoids narrowing warnings. Clean up PRINT_RATE() a bit while we're at it (avoiding signed vs. unsigned comparison warnings).
1 parent 33b6502 commit 36fded6

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

print-802_11.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -193,43 +193,43 @@ struct mgmt_header_t {
193193
#defineCAPABILITY_PRIVACY(cap) ((cap) & 0x0010)
194194

195195
struct ssid_t {
196-
uint8_tlength;
196+
u_intlength;
197197
u_charssid[33]; /* 32 + 1 for null */
198198
};
199199

200200
struct rates_t {
201-
uint8_tlength;
201+
u_intlength;
202202
uint8_trate[16];
203203
};
204204

205205
struct challenge_t {
206-
uint8_tlength;
206+
u_intlength;
207207
uint8_ttext[254]; /* 1-253 + 1 for null */
208208
};
209209

210210
struct fh_t {
211-
uint8_tlength;
211+
u_intlength;
212212
uint16_tdwell_time;
213213
uint8_thop_set;
214214
uint8_thop_pattern;
215215
uint8_thop_index;
216216
};
217217

218218
struct ds_t {
219-
uint8_tlength;
219+
u_intlength;
220220
uint8_tchannel;
221221
};
222222

223223
struct cf_t {
224-
uint8_tlength;
224+
u_intlength;
225225
uint8_tcount;
226226
uint8_tperiod;
227227
uint16_tmax_duration;
228228
uint16_tdur_remaining;
229229
};
230230

231231
struct tim_t {
232-
uint8_tlength;
232+
u_intlength;
233233
uint8_tcount;
234234
uint8_tperiod;
235235
uint8_tbitmap_control;
@@ -403,15 +403,15 @@ struct meshcntl_t {
403403
ND_PRINT("%s%2.1f%s", _sep, (.5 * ((_r) & 0x7f)), _suf)
404404
#define PRINT_RATES(p) \
405405
if (p.rates_present) { \
406-
int z; \
407406
const char *sep = " ["; \
408-
for (z = 0; z < p.rates.length ; z++) { \
409-
PRINT_RATE(sep, p.rates.rate[z], \
410-
(p.rates.rate[z] & 0x80 ? "*" : "")); \
411-
sep = " "; \
412-
} \
413-
if (p.rates.length != 0) \
407+
if (p.rates.length != 0) { \
408+
for (u_int z = 0; z < p.rates.length ; z++) { \
409+
PRINT_RATE(sep, p.rates.rate[z], \
410+
(p.rates.rate[z] & 0x80 ? "*" : "")); \
411+
sep = " "; \
412+
} \
414413
ND_PRINT(" Mbit]"); \
414+
} \
415415
}
416416

417417
#define PRINT_DS_CHANNEL(p) \

0 commit comments

Comments
 (0)