fix string formatting CodeQL

This commit is contained in:
iceman1001
2026-08-29 16:42:01 +02:00
parent ff56ec85f9
commit 07a0ff70db
5 changed files with 6 additions and 11 deletions
+2 -2
View File
@@ -717,7 +717,7 @@ int Hf14443_4aGetCardData(iso14a_card_select_t *card) {
PrintAndLogEx(SUCCESS, " UID: " _GREEN_("%s"), sprint_hex(card->uid, card->uidlen));
PrintAndLogEx(SUCCESS, "ATQA: %02X %02X", card->atqa[1], card->atqa[0]);
PrintAndLogEx(SUCCESS, " SAK: %02X [%u]", card->sak, select_status);
PrintAndLogEx(SUCCESS, " SAK: %02X [%" PRIu64 "]", card->sak, select_status);
// a valid ATS consists of at least the length byte (TL) and 2 CRC bytes
if (card->ats_len < 3) {
@@ -2891,7 +2891,7 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
PrintAndLogEx(INFO, "---------- " _CYAN_("ISO14443-A Information") " ----------");
PrintAndLogEx(SUCCESS, " UID: " _GREEN_("%s") " %s", sprint_hex(card.uid, card.uidlen), get_uid_type(&card));
PrintAndLogEx(SUCCESS, "ATQA: " _GREEN_("%02X %02X"), card.atqa[1], card.atqa[0]);
PrintAndLogEx(SUCCESS, " SAK: " _GREEN_("%02X [%u]"), card.sak, select_status);
PrintAndLogEx(SUCCESS, " SAK: " _GREEN_("%02X [%" PRIu64 "]"), card.sak, select_status);
if (version_hw_available) {
PrintAndLogEx(DEBUG, "GetV: " _GREEN_("%s"), sprint_hex((uint8_t *)&version_hw, sizeof(version_hw)));
}
+1 -1
View File
@@ -147,7 +147,7 @@ static int fudan_get_type(iso14a_card_select_t *card, bool verbose) {
PrintAndLogEx(SUCCESS, " UID: " _GREEN_("%s"), sprint_hex(card->uid, card->uidlen));
if (verbose) {
PrintAndLogEx(SUCCESS, "ATQA: " _GREEN_("%02X %02X"), card->atqa[1], card->atqa[0]);
PrintAndLogEx(SUCCESS, " SAK: " _GREEN_("%02X [%u]"), card->sak, select_status);
PrintAndLogEx(SUCCESS, " SAK: " _GREEN_("%02X [%" PRIu64 "]"), card->sak, select_status);
if (card->ats_len >= 3) { // a valid ATS consists of at least the length byte (TL) and 2 CRC bytes
if (card->ats_len == card->ats[0] + 2)
+2 -2
View File
@@ -11350,7 +11350,7 @@ static int CmdHF14AMfInfo(const char *Cmd) {
PrintAndLogEx(INFO, "--- " _CYAN_("ISO14443-a Information") " -----------------------------");
PrintAndLogEx(SUCCESS, " UID: " _GREEN_("%s"), sprint_hex(card.uid, card.uidlen));
PrintAndLogEx(SUCCESS, "ATQA: " _GREEN_("%02X %02X"), card.atqa[1], card.atqa[0]);
PrintAndLogEx(SUCCESS, " SAK: " _GREEN_("%02X [%u]"), card.sak, select_status);
PrintAndLogEx(SUCCESS, " SAK: " _GREEN_("%02X [%" PRIu64 "]"), card.sak, select_status);
uint8_t ats_hist_pos = 0;
@@ -11966,7 +11966,7 @@ static int CmdHF14AMfISEN(const char *Cmd) {
PrintAndLogEx(INFO, "--- " _CYAN_("ISO14443-a Information") " -----------------------------");
PrintAndLogEx(SUCCESS, " UID: " _GREEN_("%s"), sprint_hex(card.uid, card.uidlen));
PrintAndLogEx(SUCCESS, "ATQA: " _GREEN_("%02X %02X"), card.atqa[1], card.atqa[0]);
PrintAndLogEx(SUCCESS, " SAK: " _GREEN_("%02X [%u]"), card.sak, select_status);
PrintAndLogEx(SUCCESS, " SAK: " _GREEN_("%02X [%" PRIu64 "]"), card.sak, select_status);
// if (setDeviceDebugLevel(DBG_DEBUG, false) != PM3_SUCCESS) {
if (setDeviceDebugLevel(DBG_EXTENDED, false) != PM3_SUCCESS) {
+1 -1
View File
@@ -141,7 +141,7 @@ static int transceive_blocking(uint8_t *txBuf, uint16_t txBufLen, uint8_t *rxBuf
uint16_t rlen_141 = 0;
if (WaitForIso14aReply(&resp, 2000, &rlen_141, NULL)) {
if (rlen_141 > rxBufLen) {
PrintAndLogEx(WARNING, "Received %"PRIu64 " bytes, rxBuf too small (%u)", rlen_141, rxBufLen);
PrintAndLogEx(WARNING, "Received %u bytes, rxBuf too small (%u)", rlen_141, rxBufLen);
memcpy(rxBuf, resp.data.asBytes, rxBufLen);
*actLen = rxBufLen;
return PM3_ESOFT;
-5
View File
@@ -3784,11 +3784,6 @@ int insert_line_if_not_exists(const char *preferredName, const char *keystr) {
return PM3_SUCCESS;
}
// A dump file that is larger than the caller's buffer used to be clamped down to
// maxdumplen and handed over as if it had that size. That is lossy, and callers
// which sniff the format from the length -- `hf 15 ski` picks iso15_tag_t vs a
// raw memory image by comparing against sizeof(iso15_tag_t) -- then misparse an
// unrelated file as the exact struct they expected. Refuse instead.
static int load_dump_check_len(const char *fn, void **pdump, size_t *dumplen, size_t maxdumplen) {
if (*dumplen <= maxdumplen) {
return PM3_SUCCESS;