hexdump: fix NUL character handling

When dumping a file containing some NUL characters, the display is wrong
because all remaining characters on the line are replaced by NUL. This
error comes from the fact that the copy of the read buffer into the
line buffer is done using strncpy() which handles NUL character as end
of string and pads the destination buffer with NUL afterwards.

To avoid data manipulation during buffer copy, simply replace strncpy()
with its memory equivalent memcpy() that does not interpret the read
data.

Signed-off-by: Mathieu Anquetin <mathieu.anquetin@groupe-cahors.com>
1 file changed