[PATCH 3/3] staging: ks7010: fix buffer overflow vulnerability

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Constant is used to allocate memory for a buffer, then buffer is
filled upto 'size' which is passed as a parameter. If 'size' is bigger
than the constant then the buffer will overflow. We could check the
'size' parameter and fail but better not to fail.

Use 'size' as the parameter to kmalloc() instead of a constant.

Signed-off-by: Tobin C. Harding <me@xxxxxxxx>
---
 drivers/staging/ks7010/ks7010_sdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c
index 3403edd..341bce4 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -683,7 +683,7 @@ static int ks7010_sdio_data_compare(struct ks_wlan_private *priv, u32 address,
 	int ret;
 	unsigned char *read_buf;
 
-	read_buf = kmalloc(ROM_BUFF_SIZE, GFP_KERNEL);
+	read_buf = kmalloc(size, GFP_KERNEL);
 	if (!read_buf)
 		return -ENOMEM;
 
-- 
2.7.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux