Nmap Development mailing list archives
[PATCH] Canonicalize trailing newlines on calls to error()
From: Brandon Enright <bmenrigh () ucsd edu>
Date: Sat, 15 Dec 2007 01:27:16 +0000
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hey all, I've been running some pretty verbose and lengthy scans lately and often end up with many 'double spaced' error lines like so: ICMP type 8 code 0 packet is only 46 bytes ICMP type 8 code 0 packet is only 46 bytes ICMP type 8 code 0 packet is only 46 bytes Most of the time Nmap tries to save lines and doesn't print "\n\n" but there are a handful of places that do. Here is the code responsible for that particular message: error("ICMP type %d code %d packet is only %d bytes\n", ping->type, ping->code, bytes); Which goes to error() which ends up calling: log_write(o.log_errors? LOG_NORMAL|LOG_STDERR : LOG_STDERR, "\n"); As you can see, a trailing newline is always included in a call to error(). Rather than remove the extra newline in error() I went ahead and looked through the code for all calls to error where the format string included a redundant "\n" and removed it. I didn't do this for *every* call to error() though, there are a few that will only appear once or are fatal enough that the probably deserve and extra break after them to hopefully get the attention of someone. The patch is attached. Brandon -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFHYy10qaGPzAsl94IRAqL/AJ0SQFWx+yWY8qYL1pqdXy7+KRrzgQCcCht/ H+dUa+mrttPHcIluM90C/jY= =jC+Z -----END PGP SIGNATURE-----
Attachment:
errorline.diff
Description:
_______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- [PATCH] Canonicalize trailing newlines on calls to error() Brandon Enright (Dec 14)
- Re: [PATCH] Canonicalize trailing newlines on calls to error() Fyodor (Dec 20)