blob: 7e5da61b07a4448241f81e8d82b72c9d3810cfbd [file] [log] [blame]
From a1c9376a115f9af4a50626d2c0fa89667afa0096 Mon Sep 17 00:00:00 2001
From: Chaitanya Tata <chaitanya.mgit@gmail.com>
Date: Thu, 27 Jul 2023 00:52:45 +0530
Subject: [PATCH 20/28] iw: connect: Fix segfault during open authentication
The check for remaining arguments is done after decrement effectively
bypassing the non-zero check and causes a segfault with below command:
"connect <SSID> auth open/shared".
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Link: https://lore.kernel.org/r/20230726192245.100897-1-Chaitanya.Tata@nordicsemi.no
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
connect.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/connect.c b/connect.c
index e5b177f..33e1a5f 100644
--- a/connect.c
+++ b/connect.c
@@ -77,6 +77,9 @@ static int iw_conn(struct nl80211_state *state,
if (argc && strcmp(*argv, "key") != 0 && strcmp(*argv, "keys") != 0)
return 1;
+ if (!argc)
+ return 0;
+
argv++;
argc--;
--
2.39.2