[Pcsclite-cvs-commit] Drivers/ccid/src commands.c,1.23,1.24

rousseau@haydn.debian.org rousseau@haydn.debian.org


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

Modified Files:
	commands.c 
Log Message:
BUG in CmdXfrBlockTPDU_T1(): the t1_transceive() returned value was
stored in an unsigned int and tested if < 0 (error case). Of course the
test was never true.


Index: commands.c
===================================================================
RCS file: /cvsroot/pcsclite/Drivers/ccid/src/commands.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- commands.c	15 Jul 2004 08:48:59 -0000	1.23
+++ commands.c	15 Jul 2004 14:08:52 -0000	1.24
@@ -525,16 +525,19 @@
 	unsigned char rx_buffer[])
 {
 	RESPONSECODE return_value = IFD_SUCCESS;
+	int ret;
 
 	DEBUG_COMM2("T=1: %d bytes", tx_length);
 
-	*rx_length = t1_transceive(&((get_ccid_slot(lun)) -> t1), 0, tx_buffer, tx_length, rx_buffer, *rx_length);
+	ret = t1_transceive(&((get_ccid_slot(lun)) -> t1), 0, tx_buffer, tx_length, rx_buffer, *rx_length);
 
-	if (*rx_length < 0)
+	if (ret < 0)
 	{
 		*rx_length = 0;
 		return_value = IFD_COMMUNICATION_ERROR;
 	}
+	else
+		*rx_length = ret;
 
 	return return_value;
 } /* CmdXfrBlockTPDU_T1 */