mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
fix some CodeQL warnings
This commit is contained in:
parent
87ac62a869
commit
160245e0d5
1 changed files with 13 additions and 7 deletions
|
@ -147,9 +147,11 @@ void printarr(const char *name, uint8_t *arr, int len) {
|
||||||
char *output = calloc(outsize, sizeof(char));
|
char *output = calloc(outsize, sizeof(char));
|
||||||
cx = snprintf(output, outsize, "uint8_t %s[] = {", name);
|
cx = snprintf(output, outsize, "uint8_t %s[] = {", name);
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
cx += snprintf(output + cx, outsize - cx, "0x%02x,", *(arr + i)); //5 bytes per byte
|
if (cx < outsize)
|
||||||
|
cx += snprintf(output + cx, outsize - cx, "0x%02x,", *(arr + i)); //5 bytes per byte
|
||||||
}
|
}
|
||||||
snprintf(output + cx, outsize - cx, "};");
|
if (cx < outsize)
|
||||||
|
snprintf(output + cx, outsize - cx, "};");
|
||||||
PrintAndLogEx(INFO, output);
|
PrintAndLogEx(INFO, output);
|
||||||
free(output);
|
free(output);
|
||||||
}
|
}
|
||||||
|
@ -165,12 +167,16 @@ void printarr_human_readable(const char *title, uint8_t *arr, int len) {
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
if (i % 16 == 0) {
|
if (i % 16 == 0) {
|
||||||
|
|
||||||
if (i == 0)
|
if (i == 0) {
|
||||||
cx += snprintf(output + cx, outsize - cx, "%02x| ", i);
|
if (cx < outsize)
|
||||||
else
|
cx += snprintf(output + cx, outsize - cx, "%02x| ", i);
|
||||||
cx += snprintf(output + cx, outsize - cx, "\n%02x| ", i);
|
} else {
|
||||||
|
if (cx < outsize)
|
||||||
|
cx += snprintf(output + cx, outsize - cx, "\n%02x| ", i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cx += snprintf(output + cx, outsize - cx, "%02x ", *(arr + i));
|
if (cx < outsize)
|
||||||
|
cx += snprintf(output + cx, outsize - cx, "%02x ", *(arr + i));
|
||||||
}
|
}
|
||||||
PrintAndLogEx(INFO, output);
|
PrintAndLogEx(INFO, output);
|
||||||
free(output);
|
free(output);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue