Nmap Development mailing list archives

nmap log_write patch


From: Michael Coulter <mjc () bitz ca>
Date: Mon, 27 Jun 2005 15:15:14 -0700


Nmap-3.81 on OpenBSD/amd64 was crashing due to bus errors. I've tracked
it down, and this looks to be the culprit.

From this url:
http://www.opengroup.org/onlinepubs/009695399/functions/vprintf.html

"As these functions invoke the va_arg macro, the value of ap after the 
return is unspecified."

It looks like ap needs to be re-initialized between the vfprintf() 
and vsnprintf() calls.

--- output.cc   Fri Feb  4 22:57:24 2005
+++ /tmp/output.cc      Mon Jun 27 15:04:13 2005
@@ -530,6 +530,8 @@
   }
   if (l & LOG_SKID_NOXLT) { skid=0; l -= LOG_SKID_NOXLT; l |= LOG_SKID; }
   if (l<0 || l>LOG_MASK) return;
+  va_end(ap);
+  va_start(ap,fmt);
   for (i=0;l;l>>=1,i++)
     {
       if (!o.logfd[i] || !(l&1)) continue;


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


Current thread: