[svn] GnuPG - r4810 - trunk/scd
svn author wk
cvs at cvs.gnupg.org
Mon Aug 11 09:42:26 CEST 2008
Author: wk
Date: 2008-08-11 09:42:25 +0200 (Mon, 11 Aug 2008)
New Revision: 4810
Modified:
trunk/scd/ChangeLog
trunk/scd/apdu.c
Log:
Fix APDU buffer problem under MAC OS.
Modified: trunk/scd/ChangeLog
===================================================================
--- trunk/scd/ChangeLog 2008-08-08 01:06:48 UTC (rev 4809)
+++ trunk/scd/ChangeLog 2008-08-11 07:42:25 UTC (rev 4810)
@@ -1,3 +1,11 @@
+2008-08-11 Werner Koch <wk at g10code.com>
+
+ * apdu.c (reset_pcsc_reader, open_pcsc_reader)
+ (reset_rapdu_reader, open_rapdu_reader): Allow ATRs of up to 33
+ bytes. Provide maximum size of ATR buffer using DIM. Such long
+ ATR are never seen in reality but the PC/SC library of MAC OS X is
+ just too buggy. Reported by Ludovic Rousseau. Fixes bug #948.
+
2008-07-30 Werner Koch <wk at g10code.com>
* app-openpgp.c (verify_a_chv): Use xtrymalloc and make the prompt
Modified: trunk/scd/apdu.c
===================================================================
--- trunk/scd/apdu.c 2008-08-08 01:06:48 UTC (rev 4809)
+++ trunk/scd/apdu.c 2008-08-11 07:42:25 UTC (rev 4810)
@@ -912,7 +912,7 @@
}
- atrlen = 33;
+ atrlen = DIM(reader_table[0].atr);
nreader = sizeof reader - 1;
err = pcsc_status (reader_table[slot].pcsc.card,
reader, &nreader,
@@ -925,7 +925,7 @@
reader_table[slot].atrlen = 0;
return pcsc_error_to_sw (err);
}
- if (atrlen >= DIM (reader_table[0].atr))
+ if (atrlen > DIM (reader_table[0].atr))
log_bug ("ATR returned by pcsc_status is too large\n");
reader_table[slot].atrlen = atrlen;
reader_table[slot].is_t0 = !!(card_protocol & PCSC_PROTOCOL_T0);
@@ -1632,7 +1632,7 @@
char reader[250];
unsigned long readerlen;
- atrlen = 32;
+ atrlen = DIM (reader_table[0].atr);
readerlen = sizeof reader -1 ;
err = pcsc_status (reader_table[slot].pcsc.card,
reader, &readerlen,
@@ -1643,7 +1643,7 @@
pcsc_error_string (err), err, readerlen);
else
{
- if (atrlen >= DIM (reader_table[0].atr))
+ if (atrlen > DIM (reader_table[0].atr))
log_bug ("ATR returned by pcsc_status is too large\n");
reader_table[slot].atrlen = atrlen;
/* If we got to here we know that a card is present
@@ -1933,7 +1933,7 @@
rapdu_msg_release (msg);
return sw;
}
- if (msg->datalen >= DIM (slotp->atr))
+ if (msg->datalen > DIM (slotp->atr))
{
log_error ("ATR returned by the RAPDU layer is too large\n");
rapdu_msg_release (msg);
@@ -2114,7 +2114,7 @@
rapdu_strerror (msg->cmd));
goto failure;
}
- if (msg->datalen >= DIM (slotp->atr))
+ if (msg->datalen > DIM (slotp->atr))
{
log_error ("ATR returned by the RAPDU layer is too large\n");
goto failure;
More information about the Gnupg-commits
mailing list