From e9b6c5fc3d876394986306f6c2bca30b0f73ae02 Mon Sep 17 00:00:00 2001 From: Robert Scheck Date: Jul 09 2010 22:19:59 +0000 Subject: - Corrected the wrong synopsis for -F/-N parameter (#601087 #c3) - Added patch to avoid pointer with free(ed) memory (#601087 #c2) --- diff --git a/iftop-0.17-fixtree.patch b/iftop-0.17-fixtree.patch new file mode 100644 index 0000000..9ccb8e9 --- /dev/null +++ b/iftop-0.17-fixtree.patch @@ -0,0 +1,57 @@ +Patch by Michal Hlavinka for iftop >= 0.17, which +fixes a problem in the stringmap implementation. When removing some node +from the tree, node itself is deallocated, but parent's pointer remains +set. This results to pointer with free(ed) memory. Further details can be +found at: https://bugzilla.redhat.com/show_bug.cgi?id=601087 + +--- iftop-0.17/stringmap.c 2003-11-07 00:37:20.000000000 +0100 ++++ iftop-0.17/stringmap.c.fixtree 2010-07-09 23:53:18.000000000 +0200 +@@ -34,6 +34,10 @@ + if (!S) return; + if (S->l) stringmap_delete(S->l); + if (S->g) stringmap_delete(S->g); ++ if (S->p) { ++ if (S->p->l == S) S->p->l = NULL; ++ else S->p->g = NULL; ++ } + + xfree(S->key); + xfree(S); +@@ -46,6 +50,10 @@ + if (!S) return; + if (S->l) stringmap_delete_free(S->l); + if (S->g) stringmap_delete_free(S->g); ++ if (S->p) { ++ if (S->p->l == S) S->p->l = NULL; ++ else S->p->g = NULL; ++ } + + xfree(S->key); + xfree(S->d.v); +@@ -75,6 +83,7 @@ + if (!(S2->l = stringmap_new())) return NULL; + S2->l->key = xstrdup(k); + S2->l->d = d; ++ S2->l->p = S2; + return NULL; + } + } else if (i > 0) { +@@ -83,6 +92,7 @@ + if (!(S2->g = stringmap_new())) return NULL; + S2->g->key = xstrdup(k); + S2->g->d = d; ++ S2->g->p = S2; + return NULL; + } + } +--- iftop-0.17/stringmap.h 2003-10-19 08:44:33.000000000 +0200 ++++ iftop-0.17/stringmap.h.fixtree 2010-07-09 23:53:37.000000000 +0200 +@@ -16,7 +16,7 @@ + typedef struct _stringmap { + char *key; + item d; +- struct _stringmap *l, *g; ++ struct _stringmap *l, *g, *p; + } *stringmap; + + stringmap stringmap_new(void); diff --git a/iftop-0.17-synopsis.patch b/iftop-0.17-synopsis.patch new file mode 100644 index 0000000..8ea4daa --- /dev/null +++ b/iftop-0.17-synopsis.patch @@ -0,0 +1,15 @@ +Patch by Robert Scheck for iftop >= 0.17, which +corrects the wrong synopsis. According to "--help", it's "-F net/mask", not +"-N net/mask", because "-N" is "don't convert port numbers to services". + +--- iftop-0.17/options.c 2006-02-08 03:57:44.000000000 +0100 ++++ iftop-0.17/options.c.synopsis 2010-07-10 00:02:49.000000000 +0200 +@@ -237,7 +237,7 @@ + fprintf(fp, + "iftop: display bandwidth usage on an interface by host\n" + "\n" +-"Synopsis: iftop -h | [-npbBP] [-i interface] [-f filter code] [-N net/mask]\n" ++"Synopsis: iftop -h | [-npbNBP] [-i interface] [-f filter code] [-F net/mask]\n" + "\n" + " -h display this message\n" + " -n don't do hostname lookups\n" diff --git a/iftop.spec b/iftop.spec index 467af60..40f0dc9 100644 --- a/iftop.spec +++ b/iftop.spec @@ -1,7 +1,7 @@ Summary: Command line tool that displays bandwidth usage on an interface Name: iftop Version: 0.17 -Release: 10%{?dist} +Release: 11%{?dist} License: GPLv2+ Group: Applications/Internet URL: http://www.ex-parrot.com/~pdw/%{name}/ @@ -9,6 +9,8 @@ Source: http://www.ex-parrot.com/~pdw/%{name}/download/%{name}-%{version}.tar.g Patch0: iftop-0.17-bandwidth.patch Patch1: iftop-0.17-man-typos.patch Patch2: iftop-0.17-ncursesw.patch +Patch3: iftop-0.17-fixtree.patch +Patch4: iftop-0.17-synopsis.patch BuildRequires: ncurses-devel, %{_includedir}/pcap.h, autoconf, automake BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -23,6 +25,8 @@ so slow?". %patch0 -p1 -b .bandwidth %patch1 -p1 -b .man-typos %patch2 -p1 -b .ncursesw +%patch3 -p1 -b .fixtree +%patch4 -p1 -b .synopsis autoreconf -f %build @@ -43,6 +47,10 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man8/%{name}.* %changelog +* Sat Jul 10 2010 Robert Scheck 0.17-11 +- Corrected the wrong synopsis for -F/-N parameter (#601087 #c3) +- Added patch to avoid pointer with free(ed) memory (#601087 #c2) + * Thu Apr 01 2010 Robert Scheck 0.17-10 - Link against ncursesw for lines with UTF-8 and PuTTY (#546032)