Nmap Development mailing list archives

Re: libnetutil/netutil.cc issues


From: David Fifield <david () bamsoftware com>
Date: Thu, 15 Aug 2013 01:02:33 -0700

On Wed, Aug 07, 2013 at 08:06:26PM +0200, Gisle Vanem wrote:
This file has several problems on Win32.

1st, line 2653:
     Snprintf(protoinfo, sizeof(protoinfo), "SCTP [%s:%d > %s:%d vtag=%lu csum=0x%08lx] IP [%s]",
       srchost, ntohs(sctp->sh_sport), dsthost, ntohs(sctp->sh_dport),
       ntohl(sctp->sh_sum), ntohl(sctp->sh_vtag)
       ipinfo);

Here the values for 'vtag' and 'csum' are swapped.

Thanks, good catch.

2nd, it uses format "%ul" several places. Is that the same as "%lu" on
all platforms? Is so, why not use that. My MingW-gcc complains on those
lines.

I changed it to %lu.

And finally, ntohl() returns u_long or in_addr_t. So shouldn't we use "%lu" and
not "%u" for "timestamp" and "csum"?

I made format string specifiers better match the types of the parameters
in r31838.

David Fifield
_______________________________________________
Sent through the dev mailing list
http://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/


Current thread: