diff mbox series

[v2,2/2] iw: fix ftm_request missing arguments segfault

Message ID 20210410111937.32813-2-benjamin.aschenbrenner@gmail.com
State New
Headers show
Series [v2,1/2] iw: fix mgmt dump missing arguments segfault | expand

Commit Message

Benjamin Aschenbrenner April 10, 2021, 11:19 a.m. UTC
When expected argument <config-file> is not passed to arguemts iw
segfaults.

Example: iw wlp2s0 measurement ftm_request

This fixes it.

Signed-off-by: Benjamin Aschenbrenner <benjamin.aschenbrenner@gmail.com>
---
 measurements.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/measurements.c b/measurements.c
index 635d942..80fe785 100644
--- a/measurements.c
+++ b/measurements.c
@@ -282,6 +282,9 @@  static int handle_ftm_req_send(struct nl80211_state *state, struct nl_msg *msg,
 	const char *file;
 	int err;
 
+	if (argc < 1)
+		return HANDLER_RET_USAGE;
+
 	file = argv[0];
 	argc--;
 	argv++;