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

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