Commit 3bf3c974 authored by Marek Behún's avatar Marek Behún Committed by Olof Johansson

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.

Fixes: 5bc7f990 ("bus: Add support for Moxtet bus")
Signed-off-by: default avatarMarek Behún <>
Reported-by: default avatarsohu0106 <>
Signed-off-by: default avatarOlof Johansson <>
parent bab8f1ff
......@@ -465,7 +465,7 @@ static ssize_t input_read(struct file *file, char __user *buf, size_t len,
struct moxtet *moxtet = file->private_data;
u8 hex[sizeof(buf) * 2 + 1];
u8 hex[sizeof(bin) * 2 + 1];
int ret, n;
ret = moxtet_spi_read(moxtet, bin);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment