Hi,

When we run ftpd in debug mode (option --debug on the command line), the
server crashes upon incoming connections. The bug comes from the
functions reply() and lreply() in the file ftpd/ftpd.c: The functions do
not "reset" the "va_list" before calling syslog(). So, the latter gets
the end of the list of arguments. This triggers a crash on my PowerPc
based target !


Please apply the following patch:

diff -Naurp OLD/ftpd/ftpd.c NEW/ftpd/ftpd.c
--- OLD/ftpd/ftpd.c     2011-03-03 19:07:26.449998496 +0100
+++ NEW/ftpd/ftpd.c     2011-03-03 19:09:12.696935892 +0100
@@ -1483,10 +1483,13 @@ reply (int n, const char *fmt, ...)
   vprintf (fmt, ap);
   printf ("\r\n");
   fflush (stdout);
+  va_end(ap);
   if (debug)
     {
       syslog (LOG_DEBUG, "<--- %d ", n);
+      va_start (ap, fmt);
       vsyslog (LOG_DEBUG, fmt, ap);
+      va_end(ap);
     }
 }
 
@@ -1499,10 +1502,13 @@ lreply (int n, const char *fmt, ...)
   vprintf (fmt, ap);
   printf ("\r\n");
   fflush (stdout);
+  va_end(ap);
   if (debug)
     {
       syslog (LOG_DEBUG, "<--- %d- ", n);
+      va_start (ap, fmt);
       vsyslog (LOG_DEBUG, fmt, ap);
+      va_end(ap);
     }
 }
 



Regards,

-- 
Rachid Koucha


Reply via email to