[Pcsclite-cvs-commit] CVS Drivers/ccid/src

CVS User rousseau ludovic.rousseau@free.fr
Mon, 02 May 2005 08:20:11 +0000


Update of /cvsroot/pcsclite/Drivers/ccid/src
In directory haydn:/tmp/cvs-serv19523

Modified Files:
	parse.c 
Log Message:
do not display the list returned by GET DATA RATES if the list size is
not a multiple of 4 (n % 4 != 0)


--- /cvsroot/pcsclite/Drivers/ccid/src/parse.c	2005/04/27 13:21:32	1.24
+++ /cvsroot/pcsclite/Drivers/ccid/src/parse.c	2005/05/02 08:20:10	1.25
@@ -18,7 +18,7 @@
 */
 
 /*
- * $Id: parse.c,v 1.24 2005/04/27 13:21:32 rousseau Exp $
+ * $Id: parse.c,v 1.25 2005/05/02 08:20:10 rousseau Exp $
  */
 
 #include <stdio.h>
@@ -225,12 +225,15 @@
 		if (n <= 0)
 			printf("   IFD does not support GET_DATA_RATES request\n");
 		else
-		{
-			int i;
+			if (n % 4) 	/* not a multiple of 4 */
+				printf("   wrong size for GET_DATA_RATES: %d\n", n);
+			else
+			{
+				int i;
 
-			for (i=0; i<n; i+=4)
-				printf("   Support %d bps\n", dw2i(buffer, i));
-		}
+				for (i=0; i<n; i+=4)
+					printf("   Support %d bps\n", dw2i(buffer, i));
+			}
 	}
 	printf("  dwDataRate: %d bps\n", dw2i(extra, 19));
 	printf("  dwMaxDataRate: %d bps\n", dw2i(extra, 23));