[Pcsclite-git-commit] [pcsc-tools] 01/01: pcsc_scan: fix a crash

Ludovic Rousseau rousseau at moszumanska.debian.org
Fri May 5 16:49:10 UTC 2017


This is an automated email from the git hooks/post-receive script.

rousseau pushed a commit to branch master
in repository pcsc-tools.

commit aa4b6070b59d585f38b10cd1ab3e881baec33011
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date:   Fri May 5 09:42:17 2017 +0200

    pcsc_scan: fix a crash
    
    In stress mode, if the first APDU exchange fails then the APDU/s
    calculation uses a division by 0 and make the program crash:
    Stress card
    APDU n°: 0
    SCardTransmit: Transaction failed.
    Total time: 229543 µs
    Exception en point flottant
---
 pcsc_scan.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/pcsc_scan.c b/pcsc_scan.c
index 86c5b00..90ef7f6 100644
--- a/pcsc_scan.c
+++ b/pcsc_scan.c
@@ -167,6 +167,8 @@ static LONG stress(LONG hContext, const char *readerName)
 	}
 	long delta = r.tv_sec * 1000000 + r.tv_usec;
 	printf("Total time: %ld µs\n", delta);
+	if (0 == count)
+		count = 1;
 	printf("%f APDU/s\n", 1000000. / (delta / count));
 
 	rv = SCardDisconnect(hCard, SCARD_UNPOWER_CARD);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pcsclite/pcsc-tools.git



More information about the Pcsclite-cvs-commit mailing list