iptraf-ng-1.1.4-3

9b32013 BUGFIX: fix "Floating point exception" in tcplog_flowrate_msg() (Vitezslav Samel)

Signed-off-by: Nikola Pajkovsky <npajkovs@redhat.com>
This commit is contained in:
Nikola Pajkovsky 2013-09-02 12:39:23 +02:00
parent 794f74d283
commit f7284826d5
2 changed files with 43 additions and 1 deletions

View File

@ -0,0 +1,37 @@
From 9b320138755542b927df650da0bd1e61ecaa41d7 Mon Sep 17 00:00:00 2001
Message-Id: <9b320138755542b927df650da0bd1e61ecaa41d7.1378117677.git.npajkovs@redhat.com>
From: Vitezslav Samel <vitezslav@samel.cz>
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. <ummeegge@ipfire.org>
Signed-off-by: Vitezslav Samel <vitezslav@samel.cz>
Signed-off-by: Nikola Pajkovsky <npajkovs@redhat.com>
---
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

View File

@ -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 <npajkovs@redhat.com> - 1.1.4-3
- 9b32013 BUGFIX: fix "Floating point exception" in tcplog_flowrate_msg() (Vitezslav Samel)
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild