Staging: rtl8188eu fix buffer overflow
PATCH 1/1 Staging: rtl8188eu fix buffer overflow
From: Matteo Semenzato <[email protected]>
This patch fixes the buffer overflow caused by accessing index 4 of hwxmits.
Signed-off-by Matteo Semenzato <[email protected]>
--- drivers/staging/rtl8188eu/core/rtw_xmit.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/rtl8188eu/core/rtw_xmit.c +3 -1
@@ -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;
Signature · 1 line
2.3.2
Quoted 4 lines · Matteo Semenzato
From: Matteo Semenzato <[email protected]>
This patch fixes the buffer overflow caused by accessing index 4 of hwxmits.
This is a Smatch warning? It's a false positive because the code that accesses hwxmits[4] is dead code. Just delete it that section.
regards,
dan carpenter