summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2016-02-04 10:58:49 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2016-02-04 10:58:49 +0000
commite0827dc97dee2c985bab40810663c9338a8388b5 (patch)
tree80ef0262b11b3e27c2573eb131864376123b0c34
parent6536b856787b5f0dea23c51f4cc21dea379404f2 (diff)
Fix an infinite loop when printing a country element in a management
frame in case we hit channel Tx power limits we can't pretty-print. Also ensure we consume the last item in this list. ok sthen@
-rw-r--r--usr.sbin/tcpdump/print-802_11.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/tcpdump/print-802_11.c b/usr.sbin/tcpdump/print-802_11.c
index 5a3a2068495..cc6cf0eecb3 100644
--- a/usr.sbin/tcpdump/print-802_11.c
+++ b/usr.sbin/tcpdump/print-802_11.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-802_11.c,v 1.30 2016/02/03 16:08:09 stsp Exp $ */
+/* $OpenBSD: print-802_11.c,v 1.31 2016/02/04 10:58:48 stsp Exp $ */
/*
* Copyright (c) 2005 Reyk Floeter <reyk@openbsd.org>
@@ -295,12 +295,14 @@ ieee80211_print_country(u_int8_t *data, u_int len)
data += 3;
/* channels and corresponding TX power limits */
- while (len > 3) {
+ while (len >= 3) {
/* no pretty-printing for nonsensical zero values,
* nor for operating extension IDs (values >= 201) */
if (data[0] == 0 || data[1] == 0 ||
data[0] >= 201 || data[1] >= 201) {
printf(", %d %d %d", data[0], data[1], data[2]);
+ len -= 3;
+ data += 3;
continue;
}