All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IW: Zero or Uninitialized value of keylen passing
       [not found] <CGME20171102112839epcms5p42b2f4fa5e261fb5ec26237a17fe08655@epcms5p4>
@ 2017-11-02 11:28 ` Amit Khatri
  2017-11-13  9:27   ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: Amit Khatri @ 2017-11-02 11:28 UTC (permalink / raw)
  To: johannes@sipsolutions.net, linux-wireless@vger.kernel.org
  Cc: Nitin Jhanwar, AMIT KUMAR JAISWAL

>From b755c8ee282abbd0008e9e7241c457662c90f2c3 Mon Sep 17 00:00:00 2001
From: Amit Khatri <amit.khatri@samsung.com>
Date: Thu, 2 Nov 2017 15:55:16 +0530
Subject: [PATCH] IW: Zero or Uninitialized value of keylen passing

In case of hexadeciaml keydata, keylen is not gettig updated
and passing in NLA_PUT(msg, NL80211_KEY_DATA, keylen, keydata)
as zero (becasue of local variable).

This patch initilalize keylen variable in case of hexkey data.

Signed-off-by: Amit Khatri <amit.khatri@samsung.com>
---
 util.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/util.c b/util.c
index 25d909a..1ec0791 100644
--- a/util.c
+++ b/util.c
@@ -427,12 +427,14 @@ int parse_keys(struct nl_msg *msg, char **argv, int argc)
 		switch (strlen(keydata)) {
 		case 10:
 			keydata = hex2bin(keydata, keybuf);
+			keylen = 5;
 		case 5:
 			NLA_PUT_U32(msg, NL80211_KEY_CIPHER, 0x000FAC01);
 			keylen = 5;
 			break;
 		case 26:
 			keydata = hex2bin(keydata, keybuf);
+			keylen = 13;
 		case 13:
 			NLA_PUT_U32(msg, NL80211_KEY_CIPHER, 0x000FAC05);
 			keylen = 13;
-- 
2.7.4

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

* Re: [PATCH] IW: Zero or Uninitialized value of keylen passing
  2017-11-02 11:28 ` [PATCH] IW: Zero or Uninitialized value of keylen passing Amit Khatri
@ 2017-11-13  9:27   ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2017-11-13  9:27 UTC (permalink / raw)
  To: amit.khatri, linux-wireless@vger.kernel.org
  Cc: Nitin Jhanwar, AMIT KUMAR JAISWAL

On Thu, 2017-11-02 at 11:28 +0000, Amit Khatri wrote:
> From b755c8ee282abbd0008e9e7241c457662c90f2c3 Mon Sep 17 00:00:00 2001
> From: Amit Khatri <amit.khatri@samsung.com>
> Date: Thu, 2 Nov 2017 15:55:16 +0530
> Subject: [PATCH] IW: Zero or Uninitialized value of keylen passing
> 
> In case of hexadeciaml keydata, keylen is not gettig updated
> and passing in NLA_PUT(msg, NL80211_KEY_DATA, keylen, keydata)
> as zero (becasue of local variable).
> 
> This patch initilalize keylen variable in case of hexkey data.

Uh. Please re-read the code. I'll selectively quote for you (without
your changes):

>  		case 10:
>  			keydata = hex2bin(keydata, keybuf);
>  		case 5:
>  			NLA_PUT_U32(msg, NL80211_KEY_CIPHER, 0x000FAC01);
>  			keylen = 5;
>  			break;

johannes

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

end of thread, other threads:[~2017-11-13  9:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20171102112839epcms5p42b2f4fa5e261fb5ec26237a17fe08655@epcms5p4>
2017-11-02 11:28 ` [PATCH] IW: Zero or Uninitialized value of keylen passing Amit Khatri
2017-11-13  9:27   ` Johannes Berg

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.