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