From: Colin Ian King Date: Tue, 11 Apr 2017 21:21:47 +0000 (+0100) Subject: staging: rtl8723bs: ensure cmd is large enough for %4s scanf format X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2e85ccf13a724fd6e9bdc50ffe105d68fbbb0ef5;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git staging: rtl8723bs: ensure cmd is large enough for %4s scanf format char array cmd is being scanned in using a %4s scanf format specifier and so cmd must be an array of 5 chars. Increase size to 5 chars to ensure we don't have an overflow. Detected with static analysis by cppcheck: "(error) Width 4 given in format string (no. 1) is larger than destination buffer 'cmd[4]', use %3s to prevent overflowing it." Signed-off-by: Colin Ian King Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8723bs/os_dep/rtw_proc.c b/drivers/staging/rtl8723bs/os_dep/rtw_proc.c index a2011e06d719..8de65e5c80d5 100644 --- a/drivers/staging/rtl8723bs/os_dep/rtw_proc.c +++ b/drivers/staging/rtl8723bs/os_dep/rtw_proc.c @@ -295,7 +295,7 @@ static ssize_t proc_set_cam(struct file *file, const char __user *buffer, size_t struct adapter *adapter; char tmp[32]; - char cmd[4]; + char cmd[5]; u8 id; adapter = (struct adapter *)rtw_netdev_priv(dev);