[Iftop-users] iftop segfaults on amd64 (proposed patch)

William Robinet william.robinet at conostix.com
Fri, 2 Dec 2005 11:30:55 +0100


Hi,

Iftop segfaults on my amd64 machine (Gentoo Linux 2.6.14) when I'm using a
.iftoprc file containing the line:
dns-resolution: no

Here is a patch that fixes it (it seems that it does not break the i386
version):

--- iftop-0.16/cfgfile.c        2003-11-06 19:22:16.000000000 +0100
+++ iftop-0.16_patched/cfgfile.c        2005-12-02 11:17:11.677579447
+0100
@@ -46,8 +46,13 @@
 
 int is_cfgdirective_valid(const char *s) {
     char* t;
-    for (t = config_directives[0]; t != NULL; ++t)
+    int i = 1;
+    t = config_directives[0];
+    while(t != NULL) {
         if (strcmp(s, t) == 0) return 1;
+        t = config_directives[i++];
+    }
+
     return 0;
 }


William

-- 
GPG Key ID: 74C7A949