]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
iw: fix endless loop inside handle_mgmt_dump
authorJohn Crispin <john@phrozen.org>
Fri, 17 May 2019 19:29:51 +0000 (21:29 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 24 May 2019 08:44:25 +0000 (10:44 +0200)
passing -1 will break the while loop further down in the code.

Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
mgmt.c

diff --git a/mgmt.c b/mgmt.c
index 88fe3fd25b2d3dee0f8fc4359bdce17dbddf06a3..338435d41d0e5e76907618d82ddfdec08592194a 100644 (file)
--- a/mgmt.c
+++ b/mgmt.c
@@ -109,6 +109,8 @@ static int handle_mgmt_dump(struct nl80211_state *state,
        for (i = 3; i < argc; i += 3) {
                if (strcmp(argv[i], "count") == 0) {
                        count = 1 + atoi(argv[i + 1]);
+                       if (count < 1)
+                               count = 1;
                        break;
                }