ports/87174: vsftpd gots caught in an endless loop while parsing erroneous config AND stdin is e.g. /dev/null

Pavel Gubin pg at ie.tusur.ru
Sun Oct 9 18:50:17 UTC 2005


>Number:         87174
>Category:       ports
>Synopsis:       vsftpd gots caught in an endless loop while parsing erroneous config AND stdin is e.g. /dev/null
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 09 18:50:16 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Pavel Gubin
>Release:        4.10, 4.11, 5.4
>Organization:
TUSUR
>Environment:
>Description:
When vsftpd tries to report config error, and stdin is detached from controlling terminal, it gots  caught in an endless loop because it uses die() (utility.c) to report an error condition, which in turn calls bug() (DIE_DEBUG defined by default), bug() calls vsf_sysutil_activate_noblock() which fails to set nonblocking mode when /dev/null is opened as fd=0, calls again die() etc., until the program eats up ann vertual memory and gots killes by the system.
>How-To-Repeat:
Make a vsftpd.conf with syntax error, then feed it to vsftpd:
/usr/local/libexec/vsftpd vsftpd.conf </dev/null

>Fix:
Put a file named patch-utility into files/ subdir of vsftpd port, rebuild and reinstall:

patch-utility
--- utility.c.orig      Fri Jul  2 18:26:30 2004                               
+++ utility.c   Mon Oct 10 01:19:02 2005                                       
@@ -33,6 +33,10 @@                                                             
 void                                                                          
 bug(const char* p_text)                                                       
 {                                                                             
+  static int inside_bug = 0;                                                  
+  if (inside_bug)                                                             
+    vsf_sysutil_exit(1);                                                      
+  inside_bug++;                                                               
   /* Rats. Try and write the reason to the network for diagnostics */         
   vsf_sysutil_activate_noblock(VSFTP_COMMAND_FD);                             
   (void) vsf_sysutil_write_loop(VSFTP_COMMAND_FD, "500 OOPS: ", 10);

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list