Commit 2a19f776 authored by Colin Ian King's avatar Colin Ian King Committed by Kalle Valo

wil6210: increase cmd buffer size to avoid sscanf buffer overflow

cppcheck detected a buffer overflow:

[drivers/net/wireless/ath/wil6210/debugfs.c:634]: (error) Width 8
  given in format string (no. 1) is larger than destination buffer
  'cmd[8]', use %7s to prevent overflowing it.

For the current %8s sscanf we require cmd to be 9 chars long
so increase it by 1 byte to prevent the sscan overflow (rather
than reduce the %8s specifier to %7s as cppcheck recommends).
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Acked-by: default avatarVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 6e6dd08d
...@@ -626,7 +626,7 @@ static ssize_t wil_write_back(struct file *file, const char __user *buf, ...@@ -626,7 +626,7 @@ static ssize_t wil_write_back(struct file *file, const char __user *buf,
struct wil6210_priv *wil = file->private_data; struct wil6210_priv *wil = file->private_data;
int rc; int rc;
char *kbuf = kmalloc(len + 1, GFP_KERNEL); char *kbuf = kmalloc(len + 1, GFP_KERNEL);
char cmd[8]; char cmd[9];
int p1, p2, p3; int p1, p2, p3;
if (!kbuf) if (!kbuf)
......
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