From d6bb8d630a6254ceefa7043e330853295cbfc503 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Mon, 25 Feb 2019 19:03:14 +0100 Subject: [PATCH] fix: strings --- client/cmdhffelica.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/client/cmdhffelica.c b/client/cmdhffelica.c index 42c56d900..efb6b68d7 100644 --- a/client/cmdhffelica.c +++ b/client/cmdhffelica.c @@ -277,7 +277,8 @@ uint16_t PrintFliteBlock(uint16_t tracepos, uint8_t *trace, uint16_t tracelen) { uint32_t regB = trace[7] | trace[8] << 8 | trace[9] << 16 | trace[10] << 24; line[0] = 0; for (int j = 0; j < 8; j++) - snprintf(line+( j * 2), sizeof(line)-1-(j*2), "%02x", trace[j+11]); + snprintf(line + (j*2), sizeof(line)-1-(j*2), "%02x", trace[j+11]); + PrintAndLogEx(NORMAL, "REG: regA: %d regB: %d regC: %s ", regA, regB, line); } break; @@ -287,10 +288,10 @@ uint16_t PrintFliteBlock(uint16_t tracepos, uint8_t *trace, uint16_t tracelen) { char idd[20]; char idm[20]; for (int j = 0; j < 8; j++) - snprintf(idd + (j * 2), sizeof(idd) - 1 - (j*2), "%02x", trace[j+3]); + snprintf(idd + (j*2), sizeof(idd)-1-(j*2), "%02x", trace[j+3]); for (int j = 0; j < 6; j++) - snprintf(idm + (j * 2), sizeof(idm) - 1 - (j*2), "%02x", trace[j+13]); + snprintf(idm + (j*2), sizeof(idm)-1-(j*2), "%02x", trace[j+13]); PrintAndLogEx(NORMAL, "ID Block, IDd: 0x%s DFC: 0x%02x%02x Arb: %s ", idd, trace[11], trace [12], idm); } @@ -299,10 +300,10 @@ uint16_t PrintFliteBlock(uint16_t tracepos, uint8_t *trace, uint16_t tracelen) { char idm[20]; char pmm[20]; for (int j = 0; j < 8; j++) - snprintf(idm + (j * 2), 20, "%02x", trace[j+3]); + snprintf(idm + (j*2), sizeof(idm)-1-(j*2), "%02x", trace[j+3]); for (int j = 0; j < 8; j++) - snprintf(pmm + (j * 2), 20, "%02x", trace[j+11]); + snprintf(pmm + (j*2), sizeof(pmm)-1-(j*2), "%02x", trace[j+11]); PrintAndLogEx(NORMAL, "DeviceId: IDm: 0x%s PMm: 0x%s ", idm, pmm); }