]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
wil6210: increase cmd buffer size to avoid sscanf buffer overflow
authorColin Ian King <colin.king@canonical.com>
Sun, 1 Mar 2015 17:48:33 +0000 (17:48 +0000)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 3 Mar 2015 13:48:12 +0000 (15:48 +0200)
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: Colin Ian King <colin.king@canonical.com>
Acked-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ath/wil6210/debugfs.c

index fbe27a34e1462367a6b7bfc3a2637d542db32577..3830cc20d4fa525f87a9c72f3391c8ce76501a9b 100644 (file)
@@ -626,7 +626,7 @@ static ssize_t wil_write_back(struct file *file, const char __user *buf,
        struct wil6210_priv *wil = file->private_data;
        int rc;
        char *kbuf = kmalloc(len + 1, GFP_KERNEL);
-       char cmd[8];
+       char cmd[9];
        int p1, p2, p3;
 
        if (!kbuf)