fix data diff, where wrong length was used

This commit is contained in:
iceman1001 2022-06-15 18:09:50 +02:00
commit e3b6086941

View file

@ -3071,10 +3071,10 @@ static int CmdDiff(const char *Cmd) {
// if ok, just print // if ok, just print
if (diff == 0) { if (diff == 0) {
hex_to_buffer((uint8_t *)line, inA + i, width, width, 0, 1, true); hex_to_buffer((uint8_t *)line, inA + i, width, sizeof(line), 0, 1, true);
ascii_to_buffer((uint8_t *)(line + strlen(line)), inA + i, width, width, 0); ascii_to_buffer((uint8_t *)(line + strlen(line)), inA + i, width, width, 0);
strcat(line + strlen(line), " | "); strncat(line + strlen(line), " | ", 3);
hex_to_buffer((uint8_t *)(line + strlen(line)), inB + i, width, width, 0, 1, true); hex_to_buffer((uint8_t *)(line + strlen(line)), inB + i, width, sizeof(line), 0, 1, true);
ascii_to_buffer((uint8_t *)(line + strlen(line)), inB + i, width, width, 0); ascii_to_buffer((uint8_t *)(line + strlen(line)), inB + i, width, width, 0);
} else { } else {
@ -3137,26 +3137,26 @@ static int CmdDiff(const char *Cmd) {
memset(line, 0, sizeof(line)); memset(line, 0, sizeof(line));
if (tallestA) { if (tallestA) {
hex_to_buffer((uint8_t *)line, inA + i, width, width, 0, 1, true); hex_to_buffer((uint8_t *)line, inA + i, width, sizeof(line), 0, 1, true);
ascii_to_buffer((uint8_t *)(line + strlen(line)), inA + i, width, width, 0); ascii_to_buffer((uint8_t *)(line + strlen(line)), inA + i, width, sizeof(line), 0);
strcat(line + strlen(line), " | "); strcat(line + strlen(line), " | ");
for (int j = 0; j < width; j++) { for (int j = 0; j < width; j++) {
strcat(line + strlen(line), "-- "); strncat(line + strlen(line), "-- ", 3);
} }
for (int j = 0; j < width; j++) { for (int j = 0; j < width; j++) {
strcat(line + strlen(line), "."); strncat(line + strlen(line), ".", 1);
} }
} else { } else {
for (int j = 0; j < width; j++) { for (int j = 0; j < width; j++) {
strcat(line + strlen(line), "-- "); strncat(line + strlen(line), "-- ", 3);
} }
for (int j = 0; j < width; j++) { for (int j = 0; j < width; j++) {
strcat(line + strlen(line), "."); strncat(line + strlen(line), ".", 1);
} }
strcat(line + strlen(line), " | "); strncat(line + strlen(line), " | ", 3);
hex_to_buffer((uint8_t *)(line + strlen(line)), inB + i, width, width, 0, 1, true); hex_to_buffer((uint8_t *)(line + strlen(line)), inB + i, width, sizeof(line), 0, 1, true);
ascii_to_buffer((uint8_t *)(line + strlen(line)), inB + i, width, width, 0); ascii_to_buffer((uint8_t *)(line + strlen(line)), inB + i, width, sizeof(line), 0);
} }
PrintAndLogEx(INFO, "%03X | %s", i, line); PrintAndLogEx(INFO, "%03X | %s", i, line);