mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matteo Semenzato <mattew8898@gmail.com>
To: gregkh@linuxfoundation.org, navin.patidar@gmail.com,
	hejianet@gmail.com, sudipm.mukherjee@gmail.com
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	Matteo Semenzato <mattew8898@gmail.com>
Subject: [PATCH] Staging: rtl8188eu fix buffer overflow
Date: Fri, 20 Mar 2015 15:21:40 +0100	[thread overview]
Message-ID: <1426861300-13286-1-git-send-email-mattew8898@gmail.com> (raw)

From: Matteo Semenzato <mattew8898@gmail.com>

This patch fixes the buffer overflow caused by accessing index 4 of hwxmits.

Signed-off-by: Matteo Semenzato <mattew8898@gmail.com>
---
 drivers/staging/rtl8188eu/core/rtw_xmit.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c
index 7a71df1..7b22779 100644
--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
+++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
@@ -1631,10 +1631,12 @@ void rtw_alloc_hwxmits(struct adapter *padapter)
 {
 	struct hw_xmit *hwxmits;
 	struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
+	size_t size;
 
 	pxmitpriv->hwxmit_entry = HWXMIT_ENTRY;
 
-	pxmitpriv->hwxmits = kzalloc(sizeof(struct hw_xmit) * pxmitpriv->hwxmit_entry, GFP_KERNEL);
+	size =  sizeof(struct hw_xmit) * (pxmitpriv->hwxmit_entry + 1);
+	pxmitpriv->hwxmits = kzalloc(size, GFP_KERNEL);
 
 	hwxmits = pxmitpriv->hwxmits;
 
-- 
2.3.2


             reply	other threads:[~2015-03-20 14:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-20 14:21 Matteo Semenzato [this message]
2015-03-20 18:49 ` Dan Carpenter

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=1426861300-13286-1-git-send-email-mattew8898@gmail.com \
    --to=mattew8898@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hejianet@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=navin.patidar@gmail.com \
    --cc=sudipm.mukherjee@gmail.com \
    /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

all inboxes | Powered by JetHome®