mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -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));
|
||||
cx = snprintf(output, outsize, "uint8_t %s[] = {", name);
|
||||
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);
|
||||
free(output);
|
||||
}
|
||||
|
@ -165,12 +167,16 @@ void printarr_human_readable(const char *title, uint8_t *arr, int len) {
|
|||
for (i = 0; i < len; i++) {
|
||||
if (i % 16 == 0) {
|
||||
|
||||
if (i == 0)
|
||||
cx += snprintf(output + cx, outsize - cx, "%02x| ", i);
|
||||
else
|
||||
cx += snprintf(output + cx, outsize - cx, "\n%02x| ", i);
|
||||
if (i == 0) {
|
||||
if (cx < outsize)
|
||||
cx += snprintf(output + cx, outsize - cx, "%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);
|
||||
free(output);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue