iliaa           Sat Mar 24 16:26:50 2007 UTC

  Modified files:              (Branch: PHP_4_4)
    /php-src/ext/ftp    ftp.c 
  Log:
  
  MFB: Fixed CRLF injection inside ftp_putcmd().
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/ftp/ftp.c?r1=1.68.2.22.2.5&r2=1.68.2.22.2.6&diff_format=u
Index: php-src/ext/ftp/ftp.c
diff -u php-src/ext/ftp/ftp.c:1.68.2.22.2.5 php-src/ext/ftp/ftp.c:1.68.2.22.2.6
--- php-src/ext/ftp/ftp.c:1.68.2.22.2.5 Wed Jan  3 20:04:57 2007
+++ php-src/ext/ftp/ftp.c       Sat Mar 24 16:26:50 2007
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: ftp.c,v 1.68.2.22.2.5 2007/01/03 20:04:57 nlopess Exp $ */
+/* $Id: ftp.c,v 1.68.2.22.2.6 2007/03/24 16:26:50 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -962,11 +962,19 @@
        int             size;
        char            *data;
 
+       if (strpbrk(cmd, "\r\n")) {
+               return 0;
+       } 
+
        /* build the output buffer */
        if (args && args[0]) {
                /* "cmd args\r\n\0" */
                if (strlen(cmd) + strlen(args) + 4 > FTP_BUFSIZE)
                        return 0;
+
+               if (strpbrk(args, "\r\n")) {
+                       return 0;
+               }
                size = sprintf(ftp->outbuf, "%s %s\r\n", cmd, args);
        }
        else {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to