aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChaitanya Tata <chaitanya.mgit@gmail.com>2023-07-27 00:52:45 +0530
committerJohannes Berg <johannes.berg@intel.com>2023-08-24 09:17:39 +0200
commita1c9376a115f9af4a50626d2c0fa89667afa0096 (patch)
tree7b34ea89ad9d4020765984a4fbd2eeec4248ba67
parentea706b389fd896318bd7310b058fedf11d1b6758 (diff)
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>
-rw-r--r--connect.c3
1 files changed, 3 insertions, 0 deletions
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--;