From e033940fa1d51d67e68e1eff28c5c224a2dd643b Mon Sep 17 00:00:00 2001 From: fyodor Date: Sat, 18 Jul 2009 09:53:08 +0000 Subject: [PATCH] when the normal 8192-byte write buffer for log_write isn't big enough, we previously jumped it to 1,228,800 bytes. It turns out even that isn't enough in some cases, like the guy who just wrote me that was using '-p1-65535 -d6 -vvv -oA remotehost'. Sheesh. I had another person report the same sort of thing recently. So I'm upping it to 4MB. That ought to be enough for anybody :). On UNIX, vsnprintf is nice enough to tell us how much space we will need and so we don't have to worry about this. I also updated the error message to ask people to report it to nmap-dev rather than to me specifically --- output.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/output.cc b/output.cc index bd77e41f8..8fb35f991 100644 --- a/output.cc +++ b/output.cc @@ -1052,12 +1052,12 @@ void log_vwrite(int logt, const char *fmt, va_list ap) { /* Windows seems to just give -1 rather than the amount of space we would need. So lets just gulp up a huge amount in the hope it will be enough */ - writebuflen *= 150; + writebuflen *= 500; } writebuf = (char *) safe_realloc(writebuf, writebuflen); len = Vsnprintf(writebuf, writebuflen, fmt, apcopy); if (len <= 0 || len >= writebuflen) { - fatal("%s: vsnprintf failed. Even after increasing bufferlen to %d, Vsnprintf returned %d (logt == %d). Please email this message to fyodor@insecure.org. Quitting.", __func__, writebuflen, len, logt); + fatal("%s: vsnprintf failed. Even after increasing bufferlen to %d, Vsnprintf returned %d (logt == %d). Please report this as a bug to nmap-dev (including this whole error message) as described at http://nmap.org/book/man-bugs.html. Quitting.", __func__, writebuflen, len, logt); } } if (logt == LOG_SKID && !skid_noxlate)