diff --git a/0001-BUGFIX-fix-Floating-point-exception-in-tcplog_flowra.patch b/0001-BUGFIX-fix-Floating-point-exception-in-tcplog_flowra.patch new file mode 100644 index 0000000..7a156b6 --- /dev/null +++ b/0001-BUGFIX-fix-Floating-point-exception-in-tcplog_flowra.patch @@ -0,0 +1,37 @@ +From 9b320138755542b927df650da0bd1e61ecaa41d7 Mon Sep 17 00:00:00 2001 +Message-Id: <9b320138755542b927df650da0bd1e61ecaa41d7.1378117677.git.npajkovs@redhat.com> +From: Vitezslav Samel +Date: Thu, 29 Aug 2013 10:11:42 +0200 +Subject: [PATCH] BUGFIX: fix "Floating point exception" in + tcplog_flowrate_msg() + +commit 0d55bee "tcplog_flowrate_msg(): cleanup and fix") removed +condition, which leads to zero division. + +Time diff between current time and ->conn_starttime is 0, because of +rate_print updates happen in less then 1 sec and later on, we try to +divide ->bcount by interval, which is 0, hencs zero division. + +Reported-by: Erik K. +Signed-off-by: Vitezslav Samel +Signed-off-by: Nikola Pajkovsky +--- + src/tcptable.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/tcptable.c b/src/tcptable.c +index a4133d9..e217b19 100644 +--- a/src/tcptable.c ++++ b/src/tcptable.c +@@ -437,6 +437,8 @@ static char *tcplog_flowrate_msg(struct tcptableent *entry, char *buf, + size_t bufsize) + { + time_t interval = time(NULL) - entry->conn_starttime; ++ if (interval < 1) ++ interval = 1; + + char rbuf[64]; + rate_print(entry->bcount / interval, rbuf, sizeof(rbuf)); +-- +1.8.1.2 + diff --git a/iptraf-ng.spec b/iptraf-ng.spec index 3b4b1eb..42e9fe9 100644 --- a/iptraf-ng.spec +++ b/iptraf-ng.spec @@ -1,7 +1,7 @@ Summary: A console-based network monitoring utility Name: iptraf-ng Version: 1.1.4 -Release: 2%{?dist} +Release: 3%{?dist} Source0: https://fedorahosted.org/releases/i/p/iptraf-ng/%{name}-%{version}.tar.gz Source1: iptraf-ng-logrotate.conf URL: https://fedorahosted.org/iptraf-ng/ @@ -10,6 +10,7 @@ Group: Applications/System BuildRequires: ncurses-devel Obsoletes: iptraf < 3.1 Provides: iptraf = 3.1 +Patch01: 0001-BUGFIX-fix-Floating-point-exception-in-tcplog_flowra.patch %description IPTraf-ng is a console-based network monitoring utility. IPTraf gathers @@ -31,6 +32,7 @@ on a wide variety of supported network cards. %prep %setup -q +%patch01 -p1 %build make %{?_smp_mflags} V=1 CFLAGS="-g -O2 -Wall -W -std=gnu99 %{optflags}" @@ -64,6 +66,9 @@ rm -rf %{buildroot} %config(noreplace) %{_sysconfdir}/logrotate.d/iptraf-ng %changelog +* Mon Sep 02 2013 Nikola Pajkovsky - 1.1.4-3 +- 9b32013 BUGFIX: fix "Floating point exception" in tcplog_flowrate_msg() (Vitezslav Samel) + * Sat Aug 03 2013 Fedora Release Engineering - 1.1.4-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild