From: Sudip Mukherjee Date: Sat, 5 Sep 2015 13:43:43 +0000 (+0530) Subject: staging: fbtft: use strncpy instead of strcpy X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=eb6a2dbf32a4ea2fa94f742f6494f661a807fb45;p=linux-beck.git 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: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c index 0483d33b2638..3856c8873f63 100644 --- a/drivers/staging/fbtft/fbtft_device.c +++ b/drivers/staging/fbtft/fbtft_device.c @@ -1342,7 +1342,8 @@ static int __init fbtft_device_init(void) p_name, p_num); 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; if (i == MAX_GPIOS) { pr_err(DRVNAME