[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20191018074751.GF24678@kadam>
Date: Fri, 18 Oct 2019 10:47:51 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Kangjie Lu <kjlu@....edu>
Cc: devel@...verdev.osuosl.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: rtl8192e: initializing the wep buffer
On Thu, Oct 17, 2019 at 11:57:58PM -0500, Kangjie Lu wrote:
> The "wep" buffer is not initialized. To avoid memory disclosures,
> the fix initializes it, as peer functions like rtllib_ccmp_set_key
> do.
>
> Signed-off-by: Kangjie Lu <kjlu@....edu>
> ---
> drivers/staging/rtl8192e/rtllib_crypt_wep.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/staging/rtl8192e/rtllib_crypt_wep.c b/drivers/staging/rtl8192e/rtllib_crypt_wep.c
> index b1ea650036d2..0931777ed157 100644
> --- a/drivers/staging/rtl8192e/rtllib_crypt_wep.c
> +++ b/drivers/staging/rtl8192e/rtllib_crypt_wep.c
> @@ -232,6 +232,7 @@ static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
> if (len < 0 || len > WEP_KEY_LEN)
> return -1;
>
> + memset(wep, 0, sizeof(*wep));
> memcpy(wep->key, key, len);
> wep->key_len = len;
If we read beyond wep->key_len then it's probably a bug, right? It
doesn't matter whether it's zeroed out or not. Fortunately we never
do:
memcpy(key, wep->key, wep->key_len);
So this change isn't required.
regards,
dan carpenter
Powered by blists - more mailing lists