Merge pull request #1367 from merlokk/cov

Coverity fixes
This commit is contained in:
Oleg Moiseenko
2021-07-12 12:45:24 +03:00
committed by GitHub
3 changed files with 5 additions and 4 deletions
+3 -2
View File
@@ -5205,6 +5205,7 @@ static int CmdHF14ADesChKeySettings(const char *Cmd) {
return PM3_ESOFT;
if (res == 2) {
PrintAndLogEx(ERR, "Key settings must have 1 byte length");
CLIParserFree(ctx);
return PM3_EINVARG;
}
@@ -5325,7 +5326,7 @@ static int CmdHF14ADesGetKeySettings(const char *Cmd) {
}
if (verbose)
PrintAndLogEx(INFO, "DesfireGetKeySettings[%d]: %s", buflen, sprint_hex(buf, buflen));
PrintAndLogEx(INFO, "DesfireGetKeySettings[%zu]: %s", buflen, sprint_hex(buf, buflen));
if (buflen < 2) {
PrintAndLogEx(ERR, "Command DesfireGetKeySettings returned wrong length: %d", buflen);
@@ -5504,7 +5505,7 @@ static int CmdHF14ADesGetAppNames(const char *Cmd) {
if (buflen > 0) {
PrintAndLogEx(INFO, "----------------------- " _CYAN_("File list") " -----------------------");
for (int i = 0; i < buflen; i++)
PrintAndLogEx(INFO, "AID: %06x ISO file id: %02x%02x ISO DF name[%" PRIu32 "]: %s",
PrintAndLogEx(INFO, "AID: %06x ISO file id: %02x%02x ISO DF name[%zu]: %s",
DesfireAIDByteToUint(&buf[i * 24 + 1]),
buf[i * 24 + 1 + 3], buf[i * 24 + 1 + 4],
strlen((char *)&buf[i * 24 + 1 + 5]),
+1 -1
View File
@@ -225,7 +225,7 @@ void DesfirePrintContext(DesfireContext *ctx) {
sprint_hex(ctx->sessionKeyMAC, desfire_get_key_length(ctx->keyType)));
PrintAndLogEx(INFO, " ENC: %s",
sprint_hex(ctx->sessionKeyEnc, desfire_get_key_length(ctx->keyType)));
PrintAndLogEx(INFO, " IV [%d]: %s",
PrintAndLogEx(INFO, " IV [%zu]: %s",
desfire_get_key_block_length(ctx->keyType),
sprint_hex(ctx->IV, desfire_get_key_block_length(ctx->keyType)));
+1 -1
View File
@@ -118,7 +118,7 @@ size_t DesfireSearchCRCPos(uint8_t *data, size_t datalen, uint8_t respcode, uint
break;
crcpos++; // crc may be 0x00000000 or 0x0000
if (crcpos < crclen) {
PrintAndLogEx(WARNING, "No space for crc. pos: %d", crcpos);
PrintAndLogEx(WARNING, "No space for crc. pos: %zu", crcpos);
return 0;
}