diff mbox series

[2/7] iw: fix endless loop inside handle_mgmt_dump

Message ID 20190517192956.18372-3-john@phrozen.org (mailing list archive)
State Accepted
Delegated to: Johannes Berg
Headers show
Series iw: various bug fixes | expand

Commit Message

John Crispin May 17, 2019, 7:29 p.m. UTC
passing -1 will break the while loop further down in the code.

Signed-off-by: John Crispin <john@phrozen.org>
---
 mgmt.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/mgmt.c b/mgmt.c
index 88fe3fd..338435d 100644
--- 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;
 		}