From e77781e6211bfbed9b83cc3cf81aa40543e29844 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Sat, 31 Dec 2022 10:04:30 +0100 Subject: [PATCH] only mark CRC bytes if we have 3 or more bytes, and increase the line buffer since ansi colors eats chars --- client/src/cmdtrace.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/src/cmdtrace.c b/client/src/cmdtrace.c index a714b7e32..5fbf90b0d 100644 --- a/client/src/cmdtrace.c +++ b/client/src/cmdtrace.c @@ -573,7 +573,7 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr //2 Not crc-command //--- Draw the data column - char line[18][140] = {{0}}; + char line[18][160] = {{0}}; if (data_len == 0) { if (protocol == ICLASS && duration == 2048) { @@ -633,8 +633,9 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr } + uint8_t crc_format_string_offset = 0; - if (markCRCBytes) { + if (markCRCBytes && data_len > 2) { //CRC-command if (((protocol == PROTO_HITAG1) || (protocol == PROTO_HITAGS)) && (data_len > 1)) { // Note that UID REQUEST response has no CRC, but we don't know @@ -647,6 +648,7 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr } else { if (crcStatus == 0 || crcStatus == 1) { + char *pos1 = line[(data_len - 2) / 18]; pos1 += (((data_len - 2) % 18) * 4) - 1;