Error in 2.3 regarding reader-port (infinite loop)

Werner Koch wk at
Thu Dec 30 15:51:48 CET 2021

> I have attached logs of the wrong and correct behavior I observed
> (debug-level guru, debug-all).

Yes, this is an obvious bug.  We have not yet seen it because on Unix we
prefer to use the CCID driver using a different code path and further
with 2.3 there is not much need to specify a port.

Here is the bug:

      while (dl->idx < dl->idx_max)
          const char *rdrname = pcsc.rdrname[dl->idx];

          if (DBG_READER)
            log_debug ("apdu_open_reader: %s\n", rdrname);

          /* Check the identity of reader against already opened one.  */
          for (slot = 0; slot < MAX_READER; slot++)
            if (reader_table[slot].used
                && !strcmp (reader_table[slot].rdrname, rdrname))

          if (slot == MAX_READER)
            { /* Found a new device.  */
              if (DBG_READER)
                log_debug ("apdu_open_reader: new device=%s\n", rdrname);

              /* When reader string is specified, check if it is the one.  */
              if (readerno < 0
                  && strncmp (rdrname, dl->portstr, strlen (dl->portstr)) != 0)
The /continue/ causes the loop because the loop index is not bumped.



Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <>

More information about the Gnupg-users mailing list