All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aditya <mail4adityaa@gmail.com>
To: dpenkler@gmail.com
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	Aditya <mail4adityaa@gmail.com>
Subject: [PATCH] gpib: lpvo_usb_gpib: fix heap buffer overflow in lpvo_do_write()
Date: Thu, 14 May 2026 04:50:16 +0530	[thread overview]
Message-ID: <20260513232016.94653-1-mail4adityaa@gmail.com> (raw)

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.

Cc: stable@vger.kernel.org
Signed-off-by: Aditya <mail4adityaa@gmail.com>
---
 drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c b/drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c
index e6ea9422d6f2..ff7cef08031d 100644
--- a/drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c
+++ b/drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c
@@ -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);
-- 
2.43.0


                 reply	other threads:[~2026-05-13 23:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260513232016.94653-1-mail4adityaa@gmail.com \
    --to=mail4adityaa@gmail.com \
    --cc=dpenkler@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.