[Pcsclite-cvs-commit] r4986 - /trunk/PCSC/src/simclist.c
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Wed Jun 9 11:23:32 UTC 2010
Author: rousseau
Date: Wed Jun 9 11:23:32 2010
New Revision: 4986
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=4986
Log:
Avoid a division by 0.
Closes [#312555] simclist bug in pcsc-lite
Modified:
trunk/PCSC/src/simclist.c
Modified: trunk/PCSC/src/simclist.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/simclist.c?rev=4986&op=diff
==============================================================================
--- trunk/PCSC/src/simclist.c (original)
+++ trunk/PCSC/src/simclist.c Wed Jun 9 11:23:32 2010
@@ -360,7 +360,10 @@
/* accept 1 slot overflow for fetching head and tail sentinels */
if (posstart < -1 || posstart > (int)l->numels) return NULL;
- x = (float)(posstart+1) / l->numels;
+ if (0 == l->numels)
+ x = 0;
+ else
+ x = (float)(posstart+1) / l->numels;
if (x <= 0.25) {
/* first quarter: get to posstart from head */
for (i = -1, ptr = l->head_sentinel; i < posstart; ptr = ptr->next, i++);
More information about the Pcsclite-cvs-commit
mailing list