Skip to content

Commit

Permalink
fix crc render position when data len is multiple of 16
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry Sintonen committed Sep 5, 2023
1 parent 276bd29 commit e5941bc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions client/src/cmdtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,11 +655,12 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
if (crcStatus == 0 || crcStatus == 1) {

char *pos1 = line[(data_len - 2) / TRACE_MAX_HEX_BYTES];
pos1 += (((data_len - 2) % TRACE_MAX_HEX_BYTES) * 4) - 1;
int delta = (data_len - 2) % TRACE_MAX_HEX_BYTES ? 1 : 0;
pos1 += (((data_len - 2) % TRACE_MAX_HEX_BYTES) * 4) - delta;

(*(pos1 + 6 + 1)) = '\0';
(*(pos1 + 6 + delta)) = '\0';

char *cb_str = str_dup(pos1 + 1);
char *cb_str = str_dup(pos1 + delta);

if (g_session.supports_colors) {
if (crcStatus == 0) {
Expand Down

0 comments on commit e5941bc

Please sign in to comment.