diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2022-01-04 06:56:29 +0100 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2022-01-04 06:56:29 +0100 |
commit | f9c9938b28b68bb5b433c2de981b9f26af64c6a9 (patch) | |
tree | 432fa46463c7c2d2b1b86409f5551244cd4e7dcc /scd/apdu.c | |
parent | doc: Fix the title of the man pages to GnuPG 2.3 (diff) | |
download | gnupg2-f9c9938b28b68bb5b433c2de981b9f26af64c6a9.tar.xz gnupg2-f9c9938b28b68bb5b433c2de981b9f26af64c6a9.zip |
scd,pcsc: Fix error handling for a reader with reader-port.
* scd/apdu.c (apdu_open_reader): Make sure dl->idx is always
incremented to handle error from open_pcsc_reader correctly.
--
Reported-by: Anže Jenšterle
GnuPG-bug-id: 5758
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'scd/apdu.c')
-rw-r--r-- | scd/apdu.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/scd/apdu.c b/scd/apdu.c index 04bd3e2f3..574697cc1 100644 --- a/scd/apdu.c +++ b/scd/apdu.c @@ -2248,7 +2248,7 @@ apdu_open_reader (struct dev_list *dl) npth_mutex_lock (&reader_table_lock); while (dl->idx < dl->idx_max) { - const char *rdrname = pcsc.rdrname[dl->idx]; + const char *rdrname = pcsc.rdrname[dl->idx++]; if (DBG_READER) log_debug ("apdu_open_reader: %s\n", rdrname); @@ -2270,8 +2270,6 @@ apdu_open_reader (struct dev_list *dl) continue; slot = open_pcsc_reader (rdrname); - - dl->idx++; if (slot >= 0) { npth_mutex_unlock (&reader_table_lock); @@ -2284,8 +2282,6 @@ apdu_open_reader (struct dev_list *dl) continue; } } - else - dl->idx++; } npth_mutex_unlock (&reader_table_lock); |