pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/47991: net/mtr v0.85 crashes on netbsd/i386



>Number:         47991
>Category:       pkg
>Synopsis:       net/mtr v0.85 crashes on netbsd/i386
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 03 19:40:00 +0000 2013
>Originator:     VSYakovetsky%gmail.com@localhost
>Release:        NetBSD 6.1.0_PATCH
>Organization:
        
>Environment:
        
        
System: NetBSD eheca.mixnet.ua 6.1.0_PATCH NetBSD 6.1.0_PATCH 
($eheca-1.1066.2.7$) #8: Mon May 20 15:58:23 EEST 2013 
root%eheca.mixnet.ua@localhost:/usr/src/sys/arch/i386/compile/eheca i386
Architecture: i386
Machine: i386
>Description:
net/mtr v0.85 crashes on netbsd/i386 when trying to run with csv option.
(printf() time_t issue: on netbsd/i386 long is 32 bits, time_t is 64 bits).

>How-To-Repeat:
% uname -sm
NetBSD i386

% mtr -v
mtr 0.85

% mtr -C localhost
zsh: segmentation fault (core dumped)  mtr -C localhost

gdb mtr
(gdb) set args -C localhost
(gdb) run
Starting program: /usr/pkg/sbin/mtr -C localhost

Program received signal SIGSEGV, Segmentation fault.
[Switching to LWP 1]
0xbba850bc in __vfprintf_unlocked () from /usr/lib/libc.so.12
(gdb) bt
#0  0xbba850bc in __vfprintf_unlocked () from /usr/lib/libc.so.12
#1  0xbba861eb in vfprintf () from /usr/lib/libc.so.12
#2  0xbba80fea in printf () from /usr/lib/libc.so.12
#3  0x0805202b in csv_close (now=1372874014) at report.c:349
#4  0x0804c197 in main (argc=3, argv=0xbfbfec78) at mtr.c:686
(gdb) list report.c:349,350
349           printf("MTR.%s;%lu;%s;%s;%d;%s;%d", MTR_VERSION, now, "OK", 
Hostname,
350                  at+1, name, last);
(gdb) print sizeof(time_t)
$1 = 8
(gdb) print sizeof(long)
$2 = 4
(gdb)

>Fix:
:r net/mtr/patches/patch-printf-time_t__report.c

--- report.c.orig       2013-05-15 13:24:32.000000000 +0300
+++ report.c    2013-05-15 14:36:29.000000000 +0300
@@ -340,15 +340,16 @@
     snprint_addr(name, sizeof(name), addr);
 
     int last = net_last(at);
+#ifndef NO_IPINFO
     if(!ipinfo_no) {
       char* fmtinfo = fmt_ipinfo(addr);
       if (fmtinfo != NULL) fmtinfo = trim(fmtinfo);
-      printf("MTR.%s;%lu;%s;%s;%d;%s;%s;%d", MTR_VERSION, now, "OK", Hostname,
+      printf("MTR.%s;%lld;%s;%s;%d;%s;%s;%d", MTR_VERSION, (long long)now, 
"OK", Hostname,
              at+1, name, fmtinfo, last);
-    } else {
-      printf("MTR.%s;%lu;%s;%s;%d;%s;%d", MTR_VERSION, now, "OK", Hostname,
+    } else
+#endif
+      printf("MTR.%s;%lld;%s;%s;%d;%s;%d", MTR_VERSION, (long long)now, "OK", 
Hostname,
              at+1, name, last);
-    }
 
     for( i=0; i<MAXFLD; i++ ) {
       j = fld_index[fld_active[j]];

>Unformatted:
        
        


Home | Main Index | Thread Index | Old Index