Files
s390-tools/dump2tar
Peter Oberparleiter 7e53611e3a dump2tar: fix truncated paths
When creating a tar archive, dump2tar incorrectly truncates the last
character of file paths that are exactly 100 characters long.

Paths up to 100 characters can be represented in the 100-byte name field
of a tar header entry, while longer paths are handled via an additional
tar data block. For 100-character paths, dump2tar determines that a
single header is sufficient, but then uses util_strlcpy() to store the
path into the name field. Since util_strlcpy() ensures nul-terminated
strings, the final character of the path is overwritten.

Fix this by using strncpy() instead of util_strlcpy(). Also mark the
affected name fields as "nonstring" to prevent associated compiler
warnings.

Reported-by: Steffen Maier <maier@linux.ibm.com>
Fixes: d85cf20981 ("dump2tar: Change SET_STR_FIELD to copy strings correctly")
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2023-07-20 21:45:27 +02:00
..
2017-08-21 10:55:40 +02:00
2017-08-21 10:55:40 +02:00
2023-07-20 21:45:27 +02:00
2017-08-21 10:55:40 +02:00