Blame SOURCES/0001-BUGFIX-fix-Floating-point-exception-in-tcplog_flowra.patch

4a9614
From 9b320138755542b927df650da0bd1e61ecaa41d7 Mon Sep 17 00:00:00 2001
4a9614
Message-Id: <9b320138755542b927df650da0bd1e61ecaa41d7.1378117677.git.npajkovs@redhat.com>
4a9614
From: Vitezslav Samel <vitezslav@samel.cz>
4a9614
Date: Thu, 29 Aug 2013 10:11:42 +0200
4a9614
Subject: [PATCH] BUGFIX: fix "Floating point exception" in
4a9614
 tcplog_flowrate_msg()
4a9614
4a9614
commit 0d55bee "tcplog_flowrate_msg(): cleanup and fix") removed
4a9614
condition, which leads to zero division.
4a9614
4a9614
Time diff between current time and ->conn_starttime is 0, because of
4a9614
rate_print updates happen in less then 1 sec and later on, we try to
4a9614
divide ->bcount by interval, which is 0, hencs zero division.
4a9614
4a9614
Reported-by: Erik K. <ummeegge@ipfire.org>
4a9614
Signed-off-by: Vitezslav Samel <vitezslav@samel.cz>
4a9614
Signed-off-by: Nikola Pajkovsky <npajkovs@redhat.com>
4a9614
---
4a9614
 src/tcptable.c | 2 ++
4a9614
 1 file changed, 2 insertions(+)
4a9614
4a9614
diff --git a/src/tcptable.c b/src/tcptable.c
4a9614
index a4133d9..e217b19 100644
4a9614
--- a/src/tcptable.c
4a9614
+++ b/src/tcptable.c
4a9614
@@ -437,6 +437,8 @@ static char *tcplog_flowrate_msg(struct tcptableent *entry, char *buf,
4a9614
 				 size_t bufsize)
4a9614
 {
4a9614
 	time_t interval = time(NULL) - entry->conn_starttime;
4a9614
+	if (interval < 1)
4a9614
+		interval = 1;
4a9614
 
4a9614
 	char rbuf[64];
4a9614
 	rate_print(entry->bcount / interval, rbuf, sizeof(rbuf));
4a9614
-- 
4a9614
1.8.1.2
4a9614