From cdf0a56fadfb6d5efe8cb7288383c439dfad823c Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Tue, 12 Mar 2019 19:16:23 +0100 Subject: [PATCH] iso15693: check memcpy and fix BuildInventoryResponse BuildInventoryResponse was copying 5 bytes instead of 12 bytes in the cmd buffer --- armsrc/iso15693.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/armsrc/iso15693.c b/armsrc/iso15693.c index 9959f1ef0..6e6118aae 100644 --- a/armsrc/iso15693.c +++ b/armsrc/iso15693.c @@ -621,8 +621,8 @@ void Iso15693InitReader(void) { // Encode (into the ToSend buffers) an identify request, which is the first // thing that you must send to a tag to get a response. +// It expects "out" to be at least CMD_ID_RESP large static void BuildIdentifyRequest(uint8_t *out) { - uint8_t cmd[CMD_ID_RESP] = {0, ISO15_CMD_INVENTORY, 0, 0, 0}; // flags cmd[0] = ISO15_REQ_SUBCARRIER_SINGLE | ISO15_REQ_DATARATE_HIGH | ISO15_REQ_INVENTORY | ISO15_REQINV_SLOT1; @@ -665,6 +665,7 @@ static void BuildReadBlockRequest(uint8_t **out, uint8_t *uid, uint8_t blockNumb */ // Now the VICC>VCD responses when we are simulating a tag +// It expects "out" to be at least CMD_INV_RESP large static void BuildInventoryResponse(uint8_t *out, uint8_t *uid) { uint8_t cmd[CMD_INV_RESP] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; @@ -686,7 +687,7 @@ static void BuildInventoryResponse(uint8_t *out, uint8_t *uid) { // CRC AddCrc(cmd, 10); CodeIso15693AsReader(cmd, CMD_INV_RESP); - memcpy(out, cmd, CMD_ID_RESP); + memcpy(out, cmd, CMD_INV_RESP); } // Universal Method for sending to and recv bytes from a tag