[Pcsclite-cvs-commit] r2763 - /trunk/Drivers/ccid/src/ccid_usb.c
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Thu Jan 24 09:36:15 UTC 2008
Author: rousseau
Date: Thu Jan 24 09:36:15 2008
New Revision: 2763
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=2763
Log:
ReadUSB(): return an error if we get more than 10 duplicate frames error
in one read. Avoids an infinite loop with some buggy readers.
Modified:
trunk/Drivers/ccid/src/ccid_usb.c
Modified: trunk/Drivers/ccid/src/ccid_usb.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/ccid_usb.c?rev=2763&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ccid_usb.c (original)
+++ trunk/Drivers/ccid/src/ccid_usb.c Thu Jan 24 09:36:15 2008
@@ -503,6 +503,7 @@
int rv;
char debug_header[] = "<- 121234 ";
_ccid_descriptor *ccid_descriptor = get_ccid_descriptor(reader_index);
+ int duplicate_frame = 0;
read_again:
sprintf(debug_header, "<- %06X ", (int)reader_index);
@@ -532,6 +533,12 @@
if ((*length >= BSEQ_OFFSET)
&& (buffer[BSEQ_OFFSET] < *ccid_descriptor->pbSeq -1))
{
+ duplicate_frame++;
+ if (duplicate_frame > 10)
+ {
+ DEBUG_CRITICAL("Too many duplicate frame detected");
+ return STATUS_UNSUCCESSFUL;
+ }
DEBUG_INFO("Duplicate frame detected");
goto read_again;
}
More information about the Pcsclite-cvs-commit
mailing list