From 6bc37bb33d47fe89d0519fc097af56f3746598f2 Mon Sep 17 00:00:00 2001 From: Yann GASCUEL <34003959+lnv42@users.noreply.github.com> Date: Wed, 30 Mar 2022 12:00:14 +0200 Subject: [PATCH] fix usb communications when receiving empty frame E.g. before this fix, iso15 (and probably others) raw commands expecting results but with no answer from the tag where showing the previously received commands instead of : "[!] /!\ command failed" --- client/src/comms.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/client/src/comms.c b/client/src/comms.c index 4c84dd3b2..48c142b13 100644 --- a/client/src/comms.c +++ b/client/src/comms.c @@ -414,6 +414,15 @@ __attribute__((force_align_arg_pointer)) } } } + else if ((!error) && (length == 0)) { // we received an empty frame + if (rx.ng) + rx.length = 0; // set received length to 0 + else { // old frames can't be empty + PrintAndLogEx(WARNING, "Received empty MIX packet frame (length: 0x00)"); + + error = true; + } + } if (!error) { // Get the postamble res = uart_receive(sp, (uint8_t *)&rx_raw.foopost, sizeof(PacketResponseNGPostamble), &rxlen); if ((res != PM3_SUCCESS) || (rxlen != sizeof(PacketResponseNGPostamble))) {