Nmap Security Scanner
*Intro
*Ref Guide
*Install Guide
*Download
*Changelog
*Book
*Docs
Security Lists
*Nmap Hackers
*Nmap Dev
*Bugtraq
*Full Disclosure
*Pen Test
*Basics
*More
Security Tools
*Pass crackers
*Sniffers
*Vuln Scanners
*Web scanners
*Wireless
*Exploitation
*Packet crafters
*More
Site News
Site Search:
Exploit World
Advertising
About/Contact
Credits
Sponsors:
edgeos

Nmap Development: [PATCH] Canonicalize trailing newlines on calls to error()

[PATCH] Canonicalize trailing newlines on calls to error()

From: Brandon Enright <bmenrigh_at_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-----

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org

Received on Dec 14 2007
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]