Home page logo

nmap-dev logo 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

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

The patch is attached.


Version: GnuPG v1.4.7 (GNU/Linux)


Attachment: errorline.diff

Sent through the nmap-dev mailing list
Archived at http://SecLists.Org

  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]