gpg: Avoid endless loop if a card's serial number can't be read.
authorWerner Koch <wk@gnupg.org>
Wed, 3 Apr 2019 09:26:14 +0000 (11:26 +0200)
committerWerner Koch <wk@gnupg.org>
Wed, 3 Apr 2019 09:26:14 +0000 (11:26 +0200)
* g10/skclist.c (enum_secret_keys): Move list forward on error.
--

The error is not easy to reproduce but may occur if a card is removed
at the wrong time.  Tested by changing the code.

Signed-off-by: Werner Koch <wk@gnupg.org>
g10/skclist.c

index c9c41d0..ebbaba2 100644 (file)
@@ -423,6 +423,7 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk)
                           if (opt.verbose)
                             log_info (_("error getting serial number of card: %s\n"),
                                       gpg_strerror (err));
                           if (opt.verbose)
                             log_info (_("error getting serial number of card: %s\n"),
                                       gpg_strerror (err));
+                          c->sl = c->sl->next;
                           continue;
                         }
 
                           continue;
                         }