From 0d60ff0a6c64ba483b9d2c97182abea0a64eda55 Mon Sep 17 00:00:00 2001 From: Chris Osborn Date: Fri, 15 Nov 2019 19:40:19 -0800 Subject: [PATCH] Treat characters as unsigned when logging. --- src/debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/debug.c b/src/debug.c index 56285e4..4498f09 100644 --- a/src/debug.c +++ b/src/debug.c @@ -59,7 +59,7 @@ int log_get_trace_flags() void log_trace(int type, char *line, int len) { int i = 0; - int ch; + unsigned int ch; char data[64] = "\0"; char *dptr = NULL; char text[17]; @@ -76,7 +76,7 @@ void log_trace(int type, char *line, int len) dptr = data; sprintf(dptr, "%4.4x|", i); } - ch = line[i]; + ch = ((unsigned char *) line)[i]; sprintf(dptr + 5 + ((i % 16) * 3), "%2.2x", ch); if (ch > 31 && ch < 127) { text[i % 16] = ch;