scripts/mkimage: Fix strncpy usage
Original code produces the following warning when compiled with GCC8:

  HOSTCC  scripts/mkimage
In function ‘image_set_name’,
    inlined from ‘main’ at scripts/mkimage.c:614:2:
scripts/mkimage.c:153:2: warning: ‘strncpy’ specified bound 32 equals destination size [-Wstringop-truncation]
  strncpy(image_get_name(hdr), name, IH_NMLEN);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

reduce specified bound by one to make sure that NULL-terminator is
never overwritten.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
1 parent 0d4a439 commit 6a8fee6c4eaec4f2575ce59b1b78eafd144633e2
@Andrey Smirnov Andrey Smirnov authored on 22 May 2018
Sascha Hauer committed on 23 May 2018
Showing 1 changed file
View
scripts/mkimage.c