mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Kangjie Lu <kjlu@umn.edu>
Cc: devel@driverdev.osuosl.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: rtl8192e: initializing the wep buffer
Date: Fri, 18 Oct 2019 10:47:51 +0300	[thread overview]
Message-ID: <20191018074751.GF24678@kadam> (raw)
In-Reply-To: <20191018045800.10909-1-kjlu@umn.edu>

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@umn.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


      reply	other threads:[~2019-10-18  7:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-18  4:57 Kangjie Lu
2019-10-18  7:47 ` Dan Carpenter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191018074751.GF24678@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kjlu@umn.edu \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome