* [PATCH] wil6210: increase cmd buffer size to avoid sscanf buffer overflow
@ 2015-03-01 17:48 ` Colin King
0 siblings, 0 replies; 5+ messages in thread
From: Colin King @ 2015-03-01 17:48 UTC (permalink / raw)
To: Vladimir Kondratiev, Kalle Valo, linux-wireless, wil6210, netdev
Cc: linux-kernel
From: Colin Ian King <colin.king@canonical.com>
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>
---
drivers/net/wireless/ath/wil6210/debugfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c
index 45c3558e..29aab12 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -618,7 +618,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)
--
2.1.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] wil6210: increase cmd buffer size to avoid sscanf buffer overflow
@ 2015-03-01 17:48 ` Colin King
0 siblings, 0 replies; 5+ messages in thread
From: Colin King @ 2015-03-01 17:48 UTC (permalink / raw)
To: Vladimir Kondratiev, Kalle Valo,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
wil6210-A+ZNKFmMK5xy9aJCnZT0Uw, netdev-u79uwXL29TY76Z2rM5mHXA
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA
From: Colin Ian King <colin.king-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
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-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
---
drivers/net/wireless/ath/wil6210/debugfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c
index 45c3558e..29aab12 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -618,7 +618,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)
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] wil6210: increase cmd buffer size to avoid sscanf buffer overflow
@ 2015-03-02 8:24 ` Vladimir Kondratiev
0 siblings, 0 replies; 5+ messages in thread
From: Vladimir Kondratiev @ 2015-03-02 8:24 UTC (permalink / raw)
To: Colin King, Kalle Valo, linux-wireless, wil6210, netdev; +Cc: linux-kernel
On 03/01/2015 07:48 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> 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>
> ---
> drivers/net/wireless/ath/wil6210/debugfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c
> index 45c3558e..29aab12 100644
> --- a/drivers/net/wireless/ath/wil6210/debugfs.c
> +++ b/drivers/net/wireless/ath/wil6210/debugfs.c
> @@ -618,7 +618,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)
>
Thanks for finding this. Here is my
Acked-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Thanks, Vladimir
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] wil6210: increase cmd buffer size to avoid sscanf buffer overflow
@ 2015-03-02 8:24 ` Vladimir Kondratiev
0 siblings, 0 replies; 5+ messages in thread
From: Vladimir Kondratiev @ 2015-03-02 8:24 UTC (permalink / raw)
To: Colin King, Kalle Valo, linux-wireless-u79uwXL29TY76Z2rM5mHXA,
wil6210-A+ZNKFmMK5xy9aJCnZT0Uw, netdev-u79uwXL29TY76Z2rM5mHXA
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA
On 03/01/2015 07:48 PM, Colin King wrote:
> From: Colin Ian King <colin.king-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
>
> 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-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
> ---
> drivers/net/wireless/ath/wil6210/debugfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c
> index 45c3558e..29aab12 100644
> --- a/drivers/net/wireless/ath/wil6210/debugfs.c
> +++ b/drivers/net/wireless/ath/wil6210/debugfs.c
> @@ -618,7 +618,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)
>
Thanks for finding this. Here is my
Acked-by: Vladimir Kondratiev <qca_vkondrat-A+ZNKFmMK5xy9aJCnZT0Uw@public.gmane.org>
Thanks, Vladimir
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: wil6210: increase cmd buffer size to avoid sscanf buffer overflow
2015-03-01 17:48 ` Colin King
(?)
(?)
@ 2015-03-03 13:48 ` Kalle Valo
-1 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2015-03-03 13:48 UTC (permalink / raw)
To: Colin Ian King
Cc: Vladimir Kondratiev, linux-wireless, wil6210, netdev, linux-kernel
> From: Colin Ian King <colin.king@canonical.com>
>
> 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>
Thanks, applied to wireless-drivers-next.git.
Kalle Valo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-03-03 13:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-01 17:48 [PATCH] wil6210: increase cmd buffer size to avoid sscanf buffer overflow Colin King
2015-03-01 17:48 ` Colin King
2015-03-02 8:24 ` Vladimir Kondratiev
2015-03-02 8:24 ` Vladimir Kondratiev
2015-03-03 13:48 ` Kalle Valo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.