Skip to content

Commit 3bf3c97

Browse files
elkabloolofj
authored andcommitted
bus: moxtet: fix potential stack buffer overflow
The input_read function declares the size of the hex array relative to sizeof(buf), but buf is a pointer argument of the function. The hex array is meant to contain hexadecimal representation of the bin array. Link: https://lore.kernel.org/r/[email protected] Fixes: 5bc7f99 ("bus: Add support for Moxtet bus") Signed-off-by: Marek Behún <[email protected]> Reported-by: sohu0106 <[email protected]> Signed-off-by: Olof Johansson <[email protected]>
1 parent bab8f1f commit 3bf3c97

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/bus/moxtet.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ static ssize_t input_read(struct file *file, char __user *buf, size_t len,
465465
{
466466
struct moxtet *moxtet = file->private_data;
467467
u8 bin[TURRIS_MOX_MAX_MODULES];
468-
u8 hex[sizeof(buf) * 2 + 1];
468+
u8 hex[sizeof(bin) * 2 + 1];
469469
int ret, n;
470470

471471
ret = moxtet_spi_read(moxtet, bin);

0 commit comments

Comments
 (0)