diff --git a/src/commands.c b/src/commands.c index b4a95b55..4d039157 100644 --- a/src/commands.c +++ b/src/commands.c @@ -531,13 +531,6 @@ RESPONSECODE SecurePINVerify(unsigned int reader_index, #define T1_S_TYPE(pcb) ((pcb) & 0x0F) #define T1_S_WTX 0x03 - /* this should not happen. It will make coverity happy */ - if (*RxLength < 4) - { - ret = IFD_COMMUNICATION_ERROR; - goto end; - } - /* WTX S-block */ if ((T1_S_BLOCK | T1_S_WTX) == RxBuffer[PCB]) { @@ -593,6 +586,13 @@ RESPONSECODE SecurePINVerify(unsigned int reader_index, ccid_descriptor->readTimeout = oldReadTimeout; } + /* this should not happen. It will make coverity happy */ + if (*RxLength < 4) + { + ret = IFD_COMMUNICATION_ERROR; + goto end; + } + /* get only the T=1 data */ memmove(RxBuffer, RxBuffer+3, *RxLength -4); *RxLength -= 4; /* remove NAD, PCB, LEN and CRC */