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

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