Questionable / Incorrect Code

NIIBE Yutaka gniibe at fsij.org
Thu Dec 25 08:53:14 CET 2014


I don't know what was going on exactly at that time, but roughly
speaking, I had pinpad related enhancement branch and Marcus had npth
related branch.  I think that I pushed first, and Marcus had to merge,
and introduced this bug unfortunately.

In the commit of 07f20f313a0b13e5c93168a8a62ff1cbb94a4514, I added
log_error call.  I guess that this change of mine confused Marcus,
perhaps.

Here is the fix.  Well, we also can compare the implementation of 2.0
branch to confirm that this is the right thing.

OK to commit?

diff --git a/scd/apdu.c b/scd/apdu.c
index 476723a..4ec6b4d 100644
--- a/scd/apdu.c
+++ b/scd/apdu.c
@@ -2336,8 +2336,6 @@ pcsc_pinpad_verify (int slot, int class, int ins, int p0, int p1,
                      pin_verify, len, result, &resultlen);
   xfree (pin_verify);
   if (sw || resultlen < 2)
-    return sw? sw : SW_HOST_INCOMPLETE_CARD_RESPONSE;
-  sw = (result[resultlen-2] << 8) | result[resultlen-1];
     {
       log_error ("control_pcsc failed: %d\n", sw);
       return sw? sw: SW_HOST_INCOMPLETE_CARD_RESPONSE;
-- 



More information about the Gnupg-devel mailing list