Skip to contentSkip to conversation

iw: Fix segfault when no args are given to offchannel

PATCH Applied Ola Olsson 2 participants 2 messages Oct 21, 2015

lore
Share & tools
lore

Ola Olsson

author
#0 lore raw

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.

---
 offch.c |    4 ++++
 1 file changed, 4 insertions(+)
offch.c +4 -0
index 49b101a..04bf4c6 100644
@@ -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
#1 lore raw
Quoted 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