From a9b265ff1b9e3c69d14659b27117ffeaf6b2d3f2 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Thu, 28 Jan 2021 12:16:02 +0100 Subject: [PATCH] cppcheck fixes call from hf_aveful with NULL --- armsrc/mifareutil.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/armsrc/mifareutil.c b/armsrc/mifareutil.c index 07cf7b098..8fc747a97 100644 --- a/armsrc/mifareutil.c +++ b/armsrc/mifareutil.c @@ -68,9 +68,12 @@ uint8_t mf_crypto1_encrypt4bit(struct Crypto1State *pcs, uint8_t data) { // send X byte basic commands int mifare_sendcmd(uint8_t cmd, uint8_t *data, uint8_t data_size, uint8_t *answer, uint8_t *answer_parity, uint32_t *timing) { + uint8_t dcmd[data_size + 3]; dcmd[0] = cmd; - memcpy(dcmd + 1, data, data_size); + if (data_size > 0) + memcpy(dcmd + 1, data, data_size); + AddCrc14A(dcmd, data_size + 1); ReaderTransmit(dcmd, sizeof(dcmd), timing); int len = ReaderReceive(answer, answer_parity);