diff mbox series

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

Message ID CAASiZWagFdx+5Nfq383zgJkMcL_T_hqVeWTgPx2ej8J6U=DfLQ@mail.gmail.com
State New
Headers show
Series None | expand

Commit Message

Benjamin Aschenbrenner March 22, 2021, 2:55 p.m. UTC
From: Benjamin Aschenbrenner <benjamin.aschenbrenner@gmail.com>
Date: Mon, 22 Mar 2021 15:19:00 +0100
Subject: [PATCH 2/2] iw: fix ftm_request missing arguments segfault

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(+)

     argv++;

Comments

Johannes Berg April 8, 2021, 8:13 a.m. UTC | #1
On Mon, 2021-03-22 at 15:55 +0100, Benjamin Aschenbrenner wrote:
> 

> @@ -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;


Something along the line replaced tabs by 4 spaces, so the patches don't
apply. Please resend.

Thanks,
johannes
Benjamin Aschenbrenner April 10, 2021, 11:14 a.m. UTC | #2
Sorry I missed that. Will resend as v2.

Kind regards,
Benjamin
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--;