From: Ola Olsson Date: Wed, 21 Oct 2015 12:02:24 +0000 (+0200) Subject: iw: Fix segfault when no args are given to offchannel X-Git-Tag: v4.7~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7082f96ff89fb8a1d05d9fd94fb67ba41a536302;p=thirdparty%2Fiw.git iw: Fix segfault when no args are given to offchannel 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 [remove braces] Signed-off-by: Johannes Berg --- diff --git a/offch.c b/offch.c index 49b101a..19e170e 100644 --- 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));