]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
iw: Fix segfault when no args are given to offchannel
authorOla Olsson <ola1olsson@gmail.com>
Wed, 21 Oct 2015 12:02:24 +0000 (14:02 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 21 Oct 2015 12:04:46 +0000 (14:04 +0200)
The offchannel command assumes that frequency and duration
are given as arguments, otherwise iw segfaults - fix that
by printing help text instead.

Signed-off-by: Ola Olsson <ola.olsson@sonymobile.com>
[remove braces]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
offch.c

diff --git a/offch.c b/offch.c
index 49b101a66001ded5e7cfe0622d7ca025084ea678..19e170e906af5ec0d694caf8506950cd9983201f 100644 (file)
--- a/offch.c
+++ b/offch.c
@@ -15,6 +15,9 @@ static int offchannel(struct nl80211_state *state,
 {
        char *end;
 
+       if (argc < 2)
+               return 1;
+
        /* freq */
        NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ,
                    strtoul(argv[0], &end, 10));