[PATCH 10/11] ALSA: line6: Fix potential OOB write in line6_capture_copy()
From: Takashi Iwai
Date: Thu Oct 08 2026 - 15:32:30 EST
line6_capture_copy() copies the data for the original byte size, but
the buffer overwrap is checked against the frame size. Because of it,
when the data size isn't aligned in frames, the remaining bytes might
be still copied above the buffer size.
For avoiding the potential OOB write, correct the copied data size in
line6_capture_copy() to be aligned with frames.
Fixes: 1027f476f507 ("staging: line6: sync with upstream")
Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
---
sound/usb/line6/capture.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/usb/line6/capture.c b/sound/usb/line6/capture.c
index 6dbaf30232f9..3e1f40d6b481 100644
--- a/sound/usb/line6/capture.c
+++ b/sound/usb/line6/capture.c
@@ -117,7 +117,8 @@ void line6_capture_copy(struct snd_line6_pcm *line6pcm, char *fbuf, int fsize)
} else {
/* copy single chunk */
memcpy(runtime->dma_area +
- line6pcm->in.pos_done * bytes_per_frame, fbuf, fsize);
+ line6pcm->in.pos_done * bytes_per_frame, fbuf,
+ frames * bytes_per_frame);
}
line6pcm->in.pos_done += frames;
--
2.55.0