[Pcsclite-muscle] Potential hang in SCardTransmit

Maksim Ivanov emaxx at google.com
Tue Jul 28 15:34:06 EDT 2020


Hello,

It seems that there's (at least half-hypothetical) scenario when
SCardTransmit may hang.

The combination is:
the service's |readerState| is (SCARD_PRESENT | SCARD_POWERED |
SCARD_NEGOTIABLE);
the service's |cardProtocol| is SCARD_PROTOCOL_UNDEFINED (right after power-up);
the caller's |pioSendPci->dwProtocol| is SCARD_PROTOCOL_ANY_OLD.

In that case, the hang happens in the loop that attempts to find the
highest bit in the |cardProtocol| value; it doesn't handle the case
when the latter is zero:
https://salsa.debian.org/rousseau/PCSC/-/blob/467df10d439f6d739cd48a51f2b3dd543b1a64ce/src/winscard.c#L1583

P.S. Sorry if I misunderstood something and this case can never occur
in practice.


Regards,
Maksim



More information about the pcsclite-muscle mailing list