From: Tobin C. Harding Date: Wed, 15 Feb 2017 03:27:23 +0000 (+1100) Subject: staging: fbtft: Fix buffer overflow vulnerability X-Git-Tag: v4.12-rc1~84^2~976 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8414fe11ba2ff2422c4b73bbef3b035a2562c88a;p=thirdparty%2Flinux.git staging: fbtft: Fix buffer overflow vulnerability Module copies a user supplied string (module parameter) into a buffer using strncpy() and does not check that the buffer is null terminated. Replace call to strncpy() with call to strlcpy() ensuring that the buffer is null terminated. Signed-off-by: Tobin C. Harding Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c index 9ffb9cecc4652..6b9e8adda984d 100644 --- a/drivers/staging/fbtft/fbtft_device.c +++ b/drivers/staging/fbtft/fbtft_device.c @@ -1483,7 +1483,7 @@ static int __init fbtft_device_init(void) displays[i].pdev->name = name; displays[i].spi = NULL; } else { - strncpy(displays[i].spi->modalias, name, SPI_NAME_SIZE); + strlcpy(displays[i].spi->modalias, name, SPI_NAME_SIZE); displays[i].pdev = NULL; } }