wlcore: use strscpy() to instead of strncpy()
Subsystems (3)
PATCH 1/1 wlcore: use strscpy() to instead of strncpy()
From: Xu Panda <[email protected]>
The implementation of strscpy() is more robust and safer. That's now the recommended way to copy NUL-terminated strings.
Signed-off-by Xu Panda <[email protected]>
Signed-off-by Yang Yang <[email protected]>
--- drivers/net/wireless/ti/wlcore/boot.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/wireless/ti/wlcore/boot.c +1 -4
@@ -41,12 +41,9 @@ static int wlcore_boot_parse_fw_ver(struct wl1271 *wl, {int ret; -strncpy (wl->chip.fw_ver_str, static_data->fw_version, +strscpy (wl->chip.fw_ver_str, static_data->fw_version,sizeof (wl->chip.fw_ver_str)); -/* make sure the string is NULL-terminated */ - wl->chip.fw_ver_str[sizeof (wl->chip.fw_ver_str) -1 ] ='\0' ; - ret = sscanf(wl->chip.fw_ver_str + 4, "%u.%u.%u.%u.%u", &wl->chip.fw_ver[0], &wl->chip.fw_ver[1], &wl->chip.fw_ver[2], &wl->chip.fw_ver[3],
Signature · 1 line
2.15.2