From a7980d8e8a0693ca2424e8fe2a93470f8c7a852e Mon Sep 17 00:00:00 2001 From: Jean-Michel Picod Date: Fri, 6 Jan 2023 21:52:26 +0100 Subject: [PATCH] Use a typed constant and see if that makes CodeQL happy :) --- client/src/cmdpiv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/src/cmdpiv.c b/client/src/cmdpiv.c index 937f6a369..1c9dc701a 100644 --- a/client/src/cmdpiv.c +++ b/client/src/cmdpiv.c @@ -654,9 +654,10 @@ static int PivGetDataByTagAndPrint(Iso7816CommandChannel channel, const uint8_t } static int PivAuthenticateSign(Iso7816CommandChannel channel, uint8_t alg_id, uint8_t key_id, uint8_t nonce[], size_t nonce_len, void **result, bool decodeTLV, bool verbose) { - if (nonce_len > 0x7A) { + const size_t MAX_NONCE_LEN = 0x7a; + if (nonce_len > MAX_NONCE_LEN) { if (verbose == true) { - PrintAndLogEx(WARNING, "Nonce cannot exceed %d bytes. Got %d bytes.", 0x7a, nonce_len); + PrintAndLogEx(WARNING, "Nonce cannot exceed %d bytes. Got %d bytes.", MAX_NONCE_LEN, nonce_len); } return PM3_EINVARG; }