iw: Fix segfault when no args are given to offchannel
PATCH 1/1 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 <[email protected]>
--- offch.c | 4 ++++ 1 file changed, 4 insertions(+)
offch.c +4 -0
@@ -15,6 +15,10 @@ 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 ));
Signature · 1 line
1.7.9.5
Johannes Berg
AppliedQuoted 4 lines · Ola Olsson
The offchannel command assumes that frequency and duration are given as arguments, otherwise iw segfaults - fix that by printing help text instead.
Thanks! Applied, but I removed the unnecessary braces.
johannes