From fc6be9fea49d675a36109aafb8576b599248b454 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Mon, 29 Apr 2019 22:38:26 +0200 Subject: [PATCH] Define USB_CMD_DATA_SIZE_MIX --- client/comms.c | 2 +- include/usb_cmd.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/client/comms.c b/client/comms.c index b08345db3..4840a6b4a 100644 --- a/client/comms.c +++ b/client/comms.c @@ -173,7 +173,7 @@ void SendCommandNG(uint16_t cmd, uint8_t *data, size_t len) { void SendCommandMIX(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, void *data, size_t len) { uint64_t arg[3] = {arg0, arg1, arg2}; - if (len > USB_CMD_DATA_SIZE - sizeof(arg)) { + if (len > USB_CMD_DATA_SIZE_MIX) { PrintAndLogEx(WARNING, "Sending %d bytes of payload is too much for MIX frames, abort", len); return; } diff --git a/include/usb_cmd.h b/include/usb_cmd.h index 75ceb8515..f40a71dbc 100644 --- a/include/usb_cmd.h +++ b/include/usb_cmd.h @@ -28,6 +28,7 @@ typedef BYTE uint8_t; #endif #define USB_CMD_DATA_SIZE 512 +#define USB_CMD_DATA_SIZE_MIX ( USB_CMD_DATA_SIZE - 3 * sizeof(uint64_t) ) typedef struct { uint64_t cmd;