Summary: | net-analyzer/traceroute-nanog-6.3.10-r1 prints out cruft with -O flag | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | postmodern <brodigan> |
Component: | Current packages | Assignee: | Gentoo Netmon project <netmon> |
Status: | RESOLVED UPSTREAM | ||
Severity: | normal | ||
Priority: | High | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: | traceroute-nanog-6.3.10.patch |
Description
postmodern
2006-08-14 13:19:25 UTC
Created attachment 94268 [details, diff]
traceroute-nanog-6.3.10.patch
This patch fixes dordata.
Doesn't look amd64-specific... Hello, Would you mind giving an example? I tested the -O switch and saw no effect. Cheers, Marcelo Hmm I can't seem to reproduce it with the current gcc, but the function dordata still returns a pointer to a char array which is created on the stack. This char array should be made static. ebuild: src_compile() { $(tc-getCC) traceroute.c -o ${PN} ${CFLAGS} -lresolv -lm || die "Compile failed" } 19:59:25 (18.96 KB/s) - `/usr/portage/distfiles/traceroute-nanog_6.3.10-2.diff.gz' saved [16699] * checking ebuild checksums ;-) ... [ ok ] * checking auxfile checksums ;-) ... [ ok ] * checking miscfile checksums ;-) ... [ ok ] * checking traceroute-nanog_6.3.10.orig.tar.gz ;-) ... [ ok ] * checking traceroute-nanog_6.3.10-2.diff.gz ;-) ... [ ok ] >>> Unpacking source... >>> Unpacking traceroute-nanog_6.3.10.orig.tar.gz to /var/tmp/portage/net-analyzer/traceroute-nanog-6.3.10-r1/work >>> Unpacking traceroute-nanog_6.3.10-2.diff.gz to /var/tmp/portage/net-analyzer/traceroute-nanog-6.3.10-r1/work * Applying traceroute-nanog_6.3.10-2.diff ... [ ok ] >>> Source unpacked. >>> Compiling source in /var/tmp/portage/net-analyzer/traceroute-nanog-6.3.10-r1/work/traceroute-nanog-6.3.10.orig ... traceroute.c: In function 'main': traceroute.c:1180: warning: incompatible implicit declaration of built-in function 'strncpy' traceroute.c:1209: warning: incompatible implicit declaration of built-in function 'strncpy' traceroute.c: In function 'print_from': traceroute.c:2322: warning: incompatible implicit declaration of built-in function 'memcpy' traceroute.c: In function 'inetname': traceroute.c:2393: warning: incompatible implicit declaration of built-in function 'strcpy' traceroute.c:2408: warning: incompatible implicit declaration of built-in function 'strncpy' traceroute.c: In function 'lookup_owner': traceroute.c:2468: warning: incompatible implicit declaration of built-in function 'strchr' traceroute.c:2472: warning: incompatible implicit declaration of built-in function 'strlen' traceroute.c: In function 'get_origin': traceroute.c:2646: warning: incompatible implicit declaration of built-in function 'strcpy' traceroute.c:2648: warning: incompatible implicit declaration of built-in function 'strncpy' traceroute.c:2674: warning: incompatible implicit declaration of built-in function 'strcpy' traceroute.c:2676: warning: incompatible implicit declaration of built-in function 'strncpy' traceroute.c:2711: warning: incompatible implicit declaration of built-in function 'strlen' traceroute.c:2719: warning: incompatible implicit declaration of built-in function 'strcpy' traceroute.c:2744: warning: incompatible implicit declaration of built-in function 'strcpy' traceroute.c:2746: warning: incompatible implicit declaration of built-in functi on 'strncpy' traceroute.c:2753: warning: incompatible implicit declaration of built-in functi on 'strcpy' traceroute.c:2755: warning: incompatible implicit declaration of built-in functi on 'strncpy' traceroute.c:2760: warning: incompatible implicit declaration of built-in functi on 'strcpy' traceroute.c:2762: warning: incompatible implicit declaration of built-in functi on 'strncpy' traceroute.c:2786: warning: incompatible implicit declaration of built-in functi on 'strstr' traceroute.c:2808: warning: incompatible implicit declaration of built-in functi on 'strcpy' traceroute.c:2811: warning: incompatible implicit declaration of built-in functi on 'strcat' traceroute.c:2815: warning: incompatible implicit declaration of built-in functi on 'strncpy' traceroute.c:2818: warning: incompatible implicit declaration of built-in functi on 'strncat' traceroute.c:2958: warning: incompatible implicit declaration of built-in functi on 'strcat' traceroute.c:2966: warning: incompatible implicit declaration of built-in functi on 'strcat' I didn't see dordata return a pointer and gcc -O -o traceroute-nano traceroute.c -lresolv -m didn't crash for me on x86. but I do suggest add -DSTRING on compiling command line because too many warnings and so easy to do. if you use -Wall you will see more warnings, anyway not a good program. dordata(ans,off,class,typ,fname,contact_ptr) unsigned char *ans; int off,class,typ; char *fname; char **contact_ptr; { int len = ntohs(getshort(ans+off)); int retval = off+len+2; int i,j; char name[256]; off += 2; switch (typ) { case T_SOA: name[0]=0; off = doname(ans,off,name); name[0]=0; off = doname(ans,off,name); *contact_ptr=name; return (0); default: return (0); } } too old programming style, in this function never use i, j, len, retval..., class, fname it didn't return a pointer. sorry I misunderstood for return, but it returns name to contact_ptr. in this program only dorr calls dordata, and in dorr there is another name in it but we didn't use it as fname, why not remove reduant arguments and static name in dorr. also if typ is not T_SOA we didn't assign anything to contact_name, so it will get trouble in lookup_owner, it might be, I didn't read this code too much. but this code is not good enough. is this program worth to modify? dordata(ans,off,class,typ,fname,contact_ptr) unsigned char *ans; int off,class,typ; char *fname; char **contact_ptr; { int len = ntohs(getshort(ans+off)); int retval = off+len+2; int i,j; char name[256]; off += 2; switch (typ) { case T_SOA: name[0]=0; off = doname(ans,off,name); name[0]=0; off = doname(ans,off,name); *contact_ptr=name; return (0); default: return (0); } } dorr(ans,off,contact_ptr) unsigned char *ans; int off; char **contact_ptr; { int class, typ; char name[256]; name[0]=0; off = doname(ans,off,name); typ = ntohs(getshort(ans+off)); off = dotype(ans,off); class = ntohs(getshort(ans+off)); off = doclass(ans,off); off = dottl(ans,off); off = dordata(ans,off,class,typ,name,contact_ptr); return(off); } From what I can see upstream is at least partly active so I suggest sending patches there as we only maintain ebuilds and not the applications ;) |