- UsbCommand c = {CMD_FSK_SIM_TAG, {arg1, arg2, DemodBufferLen}};
- if (DemodBufferLen > USB_CMD_DATA_SIZE) {
- PrintAndLog("DemodBuffer too long for current implementation - length: %d - max: %d", DemodBufferLen, USB_CMD_DATA_SIZE);
- }
- memcpy(c.d.asBytes, DemodBuffer, DemodBufferLen);
+ size_t size = DemodBufferLen;
+ if (size > USB_CMD_DATA_SIZE) {
+ PrintAndLog("DemodBuffer too long for current implementation - length: %d - max: %d", size, USB_CMD_DATA_SIZE);
+ size = USB_CMD_DATA_SIZE;
+ }
+ UsbCommand c = {CMD_FSK_SIM_TAG, {arg1, arg2, size}};
+
+ memcpy(c.d.asBytes, DemodBuffer, size);