divide-by-zero bug in innd/status.c
Richard Todd
rmtodd at skywalker.ecn.ou.edu
Sat Oct 9 21:47:26 UTC 1999
Sometimes the 'size' variable in innd/status.c was zero, causing divide-by-
zero errors when computing the percentages. Fix below, similar to the
previous one with divide-by-zero on 'offered'.
Index: innd/status.c
===================================================================
RCS file: /home/rmtodd/TempCVS/Temp-CVS-Repository/inn-current/innd/status.c,v
retrieving revision 1.1.1.6
diff -u -r1.1.1.6 status.c
--- status.c 1999/10/07 02:29:54 1.1.1.6
+++ status.c 1999/10/07 06:24:50
@@ -269,6 +269,7 @@
offered = accepted + refused + rejected;
fprintf (F, " offered: %-9ld\n", offered);
if (!offered) offered = 1; /* to avoid division by zero */
+ if (!size) size = 1; /* avoid divide by zero here too */
fprintf (F, " accepted: %-9ld %%accepted: %.1f%%\n",
accepted, (float) accepted / offered * 100);
fprintf (F, " refused: %-9ld %%refused: %.1f%%\n",
More information about the inn-patches
mailing list