All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Aschenbrenner <benjamin.aschenbrenner@gmail.com>
To: johannes@sipsolutions.net
Cc: benjamin.aschenbrenner@gmail.com, linux-wireless@vger.kernel.org
Subject: [PATCH v2 2/2] iw: fix ftm_request missing arguments segfault
Date: Sat, 10 Apr 2021 13:19:37 +0200	[thread overview]
Message-ID: <20210410111937.32813-2-benjamin.aschenbrenner@gmail.com> (raw)
In-Reply-To: <20210410111937.32813-1-benjamin.aschenbrenner@gmail.com>

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 --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++;
-- 
2.30.2


      reply	other threads:[~2021-04-10 11:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-10 11:19 [PATCH v2 1/2] iw: fix mgmt dump missing arguments segfault Benjamin Aschenbrenner
2021-04-10 11:19 ` Benjamin Aschenbrenner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210410111937.32813-2-benjamin.aschenbrenner@gmail.com \
    --to=benjamin.aschenbrenner@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.