Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

pcsc: correctly handle timeout situation when refreshing reader state.

The code that treated a timeout as success was never reached, because the
surrounding if eliminated the possibility of entering the block when the return code
from SCardGetStatusChange was SCARD_E_TIMEOUT.

Issue found by Coverity Scan.
  • Loading branch information...
commit 46e0c49d7bdf0aacda2abc6d88f0b6a18ecf1530 1 parent 1f870b0
@martinpaljak martinpaljak authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  src/libopensc/reader-pcsc.c
View
3  src/libopensc/reader-pcsc.c
@@ -286,8 +286,9 @@ static int refresh_attributes(sc_reader_t *reader)
rv = priv->gpriv->SCardGetStatusChange(priv->gpriv->pcsc_ctx, 0, &priv->reader_state, 1);
- if (rv != SCARD_S_SUCCESS && rv != (LONG)SCARD_E_TIMEOUT) {
+ if (rv != SCARD_S_SUCCESS) {
if (rv == (LONG)SCARD_E_TIMEOUT) {
+ /* Timeout, no change from previous recorded state. Make sure that changed flag is not set. */
reader->flags &= ~SC_READER_CARD_CHANGED;
SC_FUNC_RETURN(reader->ctx, SC_LOG_DEBUG_VERBOSE, SC_SUCCESS);
}
Please sign in to comment.
Something went wrong with that request. Please try again.