]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
fbtft: Make sure string is NULL terminated
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 20 Nov 2019 09:57:12 +0000 (11:57 +0200)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 29 Jan 2020 04:45:21 +0000 (23:45 -0500)
commit7fb0b15249d5ecacf9925af4ea345eb585cc84ce
tree55a92553e64d8fa7d34cc6196f9a061105e4fb11
parent92bda49d66331e79346dafe7fa34a134fb6d0631
fbtft: Make sure string is NULL terminated

BugLink: https://bugs.launchpad.net/bugs/1859712
[ Upstream commit 21f585480deb4bcf0d92b08879c35d066dfee030 ]

New GCC warns about inappropriate use of strncpy():

drivers/staging/fbtft/fbtft-core.c: In function ‘fbtft_framebuffer_alloc’:
drivers/staging/fbtft/fbtft-core.c:665:2: warning: ‘strncpy’ specified bound 16 equals destination size [-Wstringop-truncation]
  665 |  strncpy(info->fix.id, dev->driver->name, 16);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Later on the copy is being used with the assumption to be NULL terminated.
Make sure string is NULL terminated by switching to snprintf().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20191120095716.26628-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/staging/fbtft/fbtft-core.c