Fix with extended LE.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos 2022-02-21 13:26:30 +01:00
parent 4e3b43ec35
commit 87a47c626b
No known key found for this signature in database
GPG key ID: C0095B7870A4CCD3

View file

@ -1146,8 +1146,7 @@ static int end_cmd_apdu_data (struct ep_out *epo, size_t orig_len)
goto error;
//len is the length after lc (whole APDU = len+5)
if (c->a->cmd_apdu_head[4] == 0 && len >= 2) { //extended
len -= 2;
if (len == 0) {
if (len == 2) {
c->a->expected_res_size = (c->a->cmd_apdu_head[5] << 8) | c->a->cmd_apdu_head[6];
if (c->a->expected_res_size == 0)
c->a->expected_res_size = 0xffff+1;