Revert "cppcheck Passing NULL after the last typed argument to a variadic function leads to undefined behaviour"

This reverts commit 8772edb6b8.
This commit is contained in:
Philippe Teuwen 2021-09-04 02:01:20 +02:00
parent 847c3d531e
commit 1092abf12e
3 changed files with 20 additions and 10 deletions

View file

@ -342,7 +342,8 @@ static int CmdHFFidoRegister(const char *cmd) {
&data[32], 32, // application parameter
&data[0], 32, // challenge parameter
&buf[67], keyHandleLen, // keyHandle
&buf[1], 65); // user public key
&buf[1], 65, // user public key
NULL, 0);
(void)res;
//PrintAndLogEx(INFO, "--xbuf(%d)[%d]: %s", res, xbuflen, sprint_hex(xbuf, xbuflen));
res = ecdsa_signature_verify(MBEDTLS_ECP_DP_SECP256R1, public_key, xbuf, xbuflen, &buf[hashp], len - hashp, true);
@ -614,7 +615,8 @@ static int CmdHFFidoAuthenticate(const char *cmd) {
&data[32], 32, // application parameter
&buf[0], 1, // user presence
&buf[1], 4, // counter
data, 32); // challenge parameter
data, 32, // challenge parameter
NULL, 0);
(void)res;
//PrintAndLogEx(INFO, "--xbuf(%d)[%d]: %s", res, xbuflen, sprint_hex(xbuf, xbuflen));
res = ecdsa_signature_verify(MBEDTLS_ECP_DP_SECP256R1, public_key, xbuf, xbuflen, &buf[5], len - 5, true);

View file

@ -190,7 +190,8 @@ static struct emv_pk *emv_pki_decode_key_ex(const struct emv_pk *enc_pk,
rem_tlv,
exp_tlv,
add_tlv,
sdatl_tlv);
sdatl_tlv,
NULL);
if (!data || data_len < 11 + pan_length) {
PrintAndLogEx(WARNING, "ERROR: Can't decode message");
return NULL;
@ -363,7 +364,8 @@ struct tlvdb *emv_pki_recover_dac_ex(const struct emv_pk *enc_pk, const struct t
tlvdb_get(db, 0x93, NULL),
3,
sda_tlv,
&sda_tdata);
&sda_tdata,
NULL);
free(sdatl); // malloc here: emv_pki_sdatl_fill
@ -393,7 +395,8 @@ struct tlvdb *emv_pki_recover_idn_ex(const struct emv_pk *enc_pk, const struct t
unsigned char *data = emv_pki_decode_message(enc_pk, 5, &data_len,
tlvdb_get(db, 0x9f4b, NULL),
2,
dyn_tlv);
dyn_tlv,
NULL);
if (!data || data_len < 3)
return NULL;
@ -428,7 +431,8 @@ struct tlvdb *emv_pki_recover_atc_ex(const struct emv_pk *enc_pk, const struct t
tlvdb_get(db, 0x9f37, NULL),
tlvdb_get(db, 0x9f02, NULL),
tlvdb_get(db, 0x5f2a, NULL),
tlvdb_get(db, 0x9f69, NULL));
tlvdb_get(db, 0x9f69, NULL),
NULL);
if (!data || data_len < 3)
return NULL;
@ -497,7 +501,8 @@ struct tlvdb *emv_pki_perform_cda_ex(const struct emv_pk *enc_pk, const struct t
unsigned char *data = emv_pki_decode_message(enc_pk, 5, &data_len,
tlvdb_get(this_db, 0x9f4b, NULL),
2,
un_tlv);
un_tlv,
NULL);
if (!data || data_len < 3) {
PrintAndLogEx(WARNING, "ERROR: can't decode message. [%zu bytes]", data_len);
return NULL;

View file

@ -203,7 +203,8 @@ static struct tlvdb *emv_pki_sign_key(const struct crypto_pk *cp,
cert_tag, rem_tag,
msg, pos,
tlvdb_get(exp_db, exp_tag, NULL),
add_tlv);
add_tlv,
NULL);
free(msg);
if (!db) {
free(exp_db);
@ -242,7 +243,8 @@ struct tlvdb *emv_pki_sign_dac(const struct crypto_pk *cp, const struct tlv *dac
struct tlvdb *db = emv_pki_sign_message(cp,
0x93, 0,
msg, pos,
sda_tlv);
sda_tlv,
NULL);
free(msg);
@ -266,7 +268,8 @@ struct tlvdb *emv_pki_sign_idn(const struct crypto_pk *cp, const struct tlv *idn
struct tlvdb *db = emv_pki_sign_message(cp,
0x9f4b, 0,
msg, pos,
dyn_tlv);
dyn_tlv,
NULL);
free(msg);