From eb0d92ea98b730ea9be3dbf094308dbd464dbb57 Mon Sep 17 00:00:00 2001 From: Jean-Michel Picod Date: Tue, 1 Oct 2024 08:29:27 +0200 Subject: [PATCH] Fix deleted line return For some reason, `isprint()` claims that `0xff` is printable. But it's used by print functions as a magic value to suppress the line return. So when viewing a dump where the last byte of a block/sector is `0xff`, it was suppressing the new line between blocks/sectors. Signed-off-by: Jean-Michel Picod --- client/src/util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/util.c b/client/src/util.c index 904846e94..d89962698 100644 --- a/client/src/util.c +++ b/client/src/util.c @@ -529,7 +529,7 @@ char *sprint_hex_ascii(const uint8_t *data, const size_t len) { while (i < max_len) { unsigned char c = (unsigned char)data[i]; - tmp[pos + i] = isprint(c) ? c : '.'; + tmp[pos + i] = (isprint(c) && c != 0xff) ? c : '.'; ++i; } out: @@ -546,7 +546,7 @@ char *sprint_ascii_ex(const uint8_t *data, const size_t len, const size_t min_st while (i < max_len) { unsigned char c = (unsigned char)data[i]; - tmp[i] = isprint(c) ? c : '.'; + tmp[i] = (isprint(c) && c != 0xff) ? c : '.'; ++i; }