All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH wpan-tools] mac: range checking for command accepting only 0 or 1
@ 2015-08-19 14:13 Stefan Schmidt
  2015-08-19 14:22 ` Alexander Aring
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Schmidt @ 2015-08-19 14:13 UTC (permalink / raw)
  To: linux-wpan; +Cc: Alexander Aring, Stefan Schmidt

lbt and ackreq_default only accept 0or 1 as arguments which we did not
acount for so far. Testing invalid arguments and checking teh return
code uncovered this one.

Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com>
---
 src/mac.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/mac.c b/src/mac.c
index 76db58f..26c6fc5 100644
--- a/src/mac.c
+++ b/src/mac.c
@@ -175,6 +175,8 @@ static int handle_lbt_mode(struct nl802154_state *state,
 	mode = strtoul(argv[0], &end, 0);
 	if (*end != '\0')
 		return 1;
+	if (mode != 0 && mode != 1)
+		return 1;
 
 	NLA_PUT_U8(msg, NL802154_ATTR_LBT_MODE, mode);
 
@@ -202,6 +204,8 @@ static int handle_ackreq_default(struct nl802154_state *state,
 	ackreq = strtoul(argv[0], &end, 0);
 	if (*end != '\0')
 		return 1;
+	if (ackreq != 0 && ackreq != 1)
+		return 1;
 
 	NLA_PUT_U8(msg, NL802154_ATTR_ACKREQ_DEFAULT, ackreq);
 
-- 
2.4.3


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

end of thread, other threads:[~2015-08-19 15:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-19 14:13 [PATCH wpan-tools] mac: range checking for command accepting only 0 or 1 Stefan Schmidt
2015-08-19 14:22 ` Alexander Aring
2015-08-19 14:28   ` Stefan Schmidt
2015-08-19 14:33     ` Alexander Aring
2015-08-19 14:38       ` Alexander Aring
2015-08-19 15:27       ` Stefan Schmidt
2015-08-19 15:58         ` Alexander Aring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.