gpib: lpvo_usb_gpib: fix heap buffer overflow in lpvo_do_write()
Subsystems (2)
PATCH 1/1 gpib: lpvo_usb_gpib: fix heap buffer overflow in lpvo_do_write()
The memcpy in lpvo_do_write() uses the original unbounded 'count' parameter instead of the capped 'writesize', causing a heap buffer overflow when a user writes more than MAX_TRANSFER (3584 bytes) to /dev/lpvo_raw%d.
Fix by using 'writesize' which is already capped to MAX_TRANSFER.
Signed-off-by Aditya <[email protected]>
--- drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c +1 -1
@@ -1638,7 +1638,7 @@ static ssize_t lpvo_do_write(struct lpvo *dev, const char *buffer, size_t count) goto error; } -memcpy (buf, buffer, count); +memcpy (buf, buffer, writesize);/* this lock makes sure we don't submit URBs to gone devices */ mutex_lock (&dev->io_mutex);
Signature · 1 line
2.43.0