17347731 iftop core dumps when using more than one -f option s11-update
authorLeibo Wang <Leibo.Wang@Sun.COM>
Tue, 25 Feb 2014 17:57:53 -0800
branchs11-update
changeset 2968 3f4acbcf337b
parent 2967 4f3c932b6bc8
child 2969 f8d4fd8116f7
17347731 iftop core dumps when using more than one -f option
components/iftop/patches/07.cfgfile.c.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/iftop/patches/07.cfgfile.c.patch	Tue Feb 25 17:57:53 2014 -0800
@@ -0,0 +1,23 @@
+This patch fixed segfault when supplying multiple options like '-f' for iftop.
+The fixing has been integrated into open iftop-1.0 pre-release version. We can
+see the fixing log here: 
+http://www.ex-parrot.com/~pdw/iftop/cvs/iftop/ChangeLog
+
+--- cfgfile.c.orig	2013-12-02 00:37:09.851645000 -0800
++++ cfgfile.c	2013-12-02 00:31:53.734822000 -0800
[email protected]@ -230,8 +230,13 @@
+     stringmap S;
+ 
+     S = stringmap_find(config, directive);
+-    if (S) stringmap_delete_free(S);
+-    stringmap_insert(config, directive, item_ptr(xstrdup(s)));
++    if (S) {
++	xfree(S->d.v);
++	S->d = item_ptr(xstrdup(s));
++    }
++    else {
++	stringmap_insert(config, directive, item_ptr(xstrdup(s)));
++    }
+ }
+ 
+ int read_config(char *file, int whinge_on_error) {