Commit eb6a2dbf authored by Sudip Mukherjee's avatar Sudip Mukherjee Committed by Greg Kroah-Hartman
Browse files

staging: fbtft: use strncpy instead of strcpy



Using strcpy() is a security risk as the destination buffer size is not
checked and we may over-run the buffer. Use strncpy() instead, while
mentioning the buffer size leaving place for the NULL termination.
Signed-off-by: default avatarSudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e1b32e1e
...@@ -1342,7 +1342,8 @@ static int __init fbtft_device_init(void) ...@@ -1342,7 +1342,8 @@ static int __init fbtft_device_init(void)
p_name, p_num); p_name, p_num);
return -EINVAL; return -EINVAL;
} }
strcpy(fbtft_device_param_gpios[i].name, p_name); strncpy(fbtft_device_param_gpios[i].name, p_name,
FBTFT_GPIO_NAME_SIZE - 1);
fbtft_device_param_gpios[i++].gpio = (int) val; fbtft_device_param_gpios[i++].gpio = (int) val;
if (i == MAX_GPIOS) { if (i == MAX_GPIOS) {
pr_err(DRVNAME pr_err(DRVNAME
......
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