linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iw: Fix segfault when no args are given to offchannel
@ 2015-10-21 12:02 Ola Olsson
  2015-10-21 12:05 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: Ola Olsson @ 2015-10-21 12:02 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Ola Olsson, Ola Olsson

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>
---
 offch.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/offch.c b/offch.c
index 49b101a..04bf4c6 100644
--- a/offch.c
+++ b/offch.c
@@ -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));
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] iw: Fix segfault when no args are given to offchannel
  2015-10-21 12:02 [PATCH] iw: Fix segfault when no args are given to offchannel Ola Olsson
@ 2015-10-21 12:05 ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2015-10-21 12:05 UTC (permalink / raw)
  To: Ola Olsson; +Cc: linux-wireless, Ola Olsson

On Wed, 2015-10-21 at 14:02 +0200, Ola Olsson wrote:
> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-21 12:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-21 12:02 [PATCH] iw: Fix segfault when no args are given to offchannel Ola Olsson
2015-10-21 12:05 ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).