mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
Make sure strings are properly copied in the SET_STR_FIELD
macro by using util_strlcpy().
This gets rid of the following GCC8 compile warnings:
In function ‘init_header’,
inlined from ‘emit_header’ at tar.c:189:2:
tar.c:81:2: warning: ‘strncpy’ specified bound 100 equals destination
size [-Wstringop-truncation]
strncpy((obj)->name, (value), sizeof((obj)->name))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tar.c:94:2: note: in expansion of macro ‘SET_STR_FIELD’
SET_STR_FIELD(header, name, filename);
^~~~~~~~~~~~~
tar.c:81:2: warning: ‘strncpy’ specified bound 100 equals destination
size [-Wstringop-truncation]
strncpy((obj)->name, (value), sizeof((obj)->name))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tar.c:94:2: note: in expansion of macro ‘SET_STR_FIELD’
SET_STR_FIELD(header, name, filename);
^~~~~~~~~~~~~
tar.c:81:2: warning: ‘strncpy’ specified bound 100 equals destination
size [-Wstringop-truncation]
strncpy((obj)->name, (value), sizeof((obj)->name))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tar.c:96:3: note: in expansion of macro ‘SET_STR_FIELD’
SET_STR_FIELD(header, linkname, link);
^~~~~~~~~~~~~
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>