On Thu, Mar 10, 2005 at 03:36:45AM +0100, christophe wrote:
> > Hmm ... that is curious.  I wonder if the 4096-byte stack buffer is
> > too large for your system.  Could you try changing:
> 
> If that has something to do with my system, I can precise it's an ibook
> first generation (clamshell) with a G3 366 MHz and 128 M Ram.

Thanks for the report.  I think the problem is that I used
varargs/vsnprintf in a non-portable way.  You must reset the va_list
between calls to vsnprintf.  Here is a patch, which will be in the
next version of Nmap:

--- output.cc   (revision 2656)
+++ output.cc   (working copy)
@@ -523,9 +523,10 @@
   bool buf_alloced = false;
   int rc = 0;
 
-  va_start(ap, fmt);
   if (l & LOG_STDOUT) {
+    va_start(ap, fmt);
     vfprintf(o.nmap_stdout, fmt, ap);
+    va_end(ap);
     l-=LOG_STDOUT;
   }
   if (l & LOG_SKID_NOXLT) { skid=0; l -= LOG_SKID_NOXLT; l |= LOG_SKID; }
@@ -534,7 +535,9 @@
     {
       if (!o.logfd[i] || !(l&1)) continue;
       while(1) {
+       va_start(ap, fmt);
        rc = vsnprintf(buf,bufsz, fmt, ap);
+       va_end(ap);
        if (rc >= 0 && rc < bufsz)
          break; // Successful
        // D'oh!  Apparently not enough space - lets try a bigger buffer
@@ -545,7 +548,6 @@
       if (skid && ((1<<i)&LOG_SKID)) skid_output(buf);
       fwrite(buf,1,strlen(buf),o.logfd[i]);
     }
-  va_end(ap);
 
   if (buf_alloced)
     free(buf);


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to