avoid cppcheck errors on uninit vars

This commit is contained in:
Philippe Teuwen
2026-02-21 14:11:26 +01:00
parent 5b6c1cdb97
commit 5458a95fda
5 changed files with 8 additions and 2 deletions

View File

@@ -110,6 +110,8 @@ uint16_t mifare_sendcmd(uint8_t cmd, uint8_t *data, uint8_t data_size, uint8_t *
uint16_t mifare_sendcmd_schann(uint8_t *data, uint8_t data_size, uint8_t *answer, uint16_t answer_len, uint8_t *answer_parity, uint32_t *timing) {
uint8_t dcmd[data_size + 2];
memset(dcmd, 0, sizeof(dcmd));
if (data_size > 0) {
memcpy(dcmd, data, data_size);
}

View File

@@ -225,6 +225,7 @@ static int info_hf_tesla(bool parse_certs) {
} else {
uint8_t auth[resplen - 2];
memset(auth, 0, sizeof(auth));
sw = get_sw(response, resplen);
if (sw == ISO7816_OK) {

View File

@@ -133,6 +133,7 @@ static void print_time(uint64_t at) {
time_t t = at;
struct tm lt;
memset(&lt, 0, sizeof(struct tm));
#if defined(_WIN32)
(void)localtime_s(&lt, &t);

View File

@@ -163,6 +163,7 @@ static void print_time(uint64_t at) {
time_t t = at;
struct tm lt;
memset(&lt, 0, sizeof(struct tm));
#if defined(_WIN32)
(void)localtime_s(&lt, &t);

View File

@@ -133,7 +133,8 @@ static void *worker(void *arg) {
int var_offset = candidate_in_K1 ? ((key_mode % 2) * 4) : (((key_mode - 2) % 2) * 4);
// Precompute the fixed half's DES key schedule.
DES_cblock fixed_key;
DES_cblock fixed_key = {0};
if (candidate_in_K1) {
// Fixed half is K2: bytes 8..15 of base_key.
memcpy(fixed_key, targs->base_key + 8, 8);
@@ -164,7 +165,7 @@ static void *worker(void *arg) {
uint8_t b2 = ((idx >> 14) & 0x7F) << 1;
uint8_t b3 = ((idx >> 21) & 0x7F) << 1;
// Build the candidate half key by starting with the fixed base half and substituting candidate bytes.
DES_cblock candidate_half;
DES_cblock candidate_half = {0};
memcpy(candidate_half, base_half, 8);
candidate_half[var_offset ] = b0;
candidate_half[var_offset + 1] = b1;