Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too strict checking on limits for SCardTransmit #137

Closed
frankmorgner opened this issue Jun 1, 2022 · 2 comments
Closed

Too strict checking on limits for SCardTransmit #137

frankmorgner opened this issue Jun 1, 2022 · 2 comments

Comments

@frankmorgner
Copy link
Contributor

PCSC/src/winscard_clnt.c

Lines 2692 to 2697 in 210efa5

if ((cbSendLength > MAX_BUFFER_SIZE_EXTENDED)
|| (*pcbRecvLength > MAX_BUFFER_SIZE_EXTENDED))
{
rv = SCARD_E_INSUFFICIENT_BUFFER;
goto end;
}

SCardTransmit checks the receive buffer length so that it doesn't exceed MAX_BUFFER_SIZE_EXTENDED. I wonder why you are requiring this limit, supplying more memory shouldn't lead to an error, I think. Also, the error code SCARD_E_INSUFFICIENT_BUFFER doesn't seem appropriate in this case. And if you wan to be strict about this, shouldn't you use 0xFFFF+3 as limit since this is the maximum size of a response APDU?

frankmorgner added a commit to frankmorgner/OpenSC that referenced this issue Jun 1, 2022
avoids PC/SC sending SCARD_E_INSUFFICIENT_BUFFER, see
LudovicRousseau/PCSC#137
@LudovicRousseau
Copy link
Owner

I think you are right.
I will check that.

LudovicRousseau added a commit to LudovicRousseau/PCSC-debug that referenced this issue Jun 1, 2022
SCardTransmit() should not fail if the receive buffer is "too large"
i.e. larger than MAX_BUFFER_SIZE_EXTENDED.

Thanks to Frank Morgner for the bug report.
" Too strict checking on limits for SCardTransmit #137 "
LudovicRousseau/PCSC#137
@LudovicRousseau
Copy link
Owner

Fixed in 967e6e5
I also fixed the same problem with SCardControl().

Thanks

Jakuje pushed a commit to OpenSC/OpenSC that referenced this issue Jun 14, 2022
avoids PC/SC sending SCARD_E_INSUFFICIENT_BUFFER, see
LudovicRousseau/PCSC#137
AlexandreGonzalo pushed a commit to AlexandreGonzalo/OpenSC that referenced this issue Nov 14, 2022
avoids PC/SC sending SCARD_E_INSUFFICIENT_BUFFER, see
LudovicRousseau/PCSC#137
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants