dmitry          Thu Apr 27 11:39:46 2006 UTC

  Modified files:              
    /php-src/sapi/cgi   fastcgi.c fastcgi.h 
  Log:
  Proper fix for bug #37205
  
  
http://cvs.php.net/viewcvs.cgi/php-src/sapi/cgi/fastcgi.c?r1=1.10&r2=1.11&diff_format=u
Index: php-src/sapi/cgi/fastcgi.c
diff -u php-src/sapi/cgi/fastcgi.c:1.10 php-src/sapi/cgi/fastcgi.c:1.11
--- php-src/sapi/cgi/fastcgi.c:1.10     Wed Apr 26 17:48:45 2006
+++ php-src/sapi/cgi/fastcgi.c  Thu Apr 27 11:39:46 2006
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: fastcgi.c,v 1.10 2006/04/26 17:48:45 dmitry Exp $ */
+/* $Id: fastcgi.c,v 1.11 2006/04/27 11:39:46 dmitry Exp $ */
 
 #include "fastcgi.h"
 #include "php.h"
@@ -441,6 +441,7 @@
        unsigned char buf[FCGI_MAX_LENGTH+8];
 
        req->keep = 0;
+       req->has_in = 0;
        req->in_len = 0;
        req->out_hdr = NULL;
        req->out_pos = req->out_buf;
@@ -509,6 +510,15 @@
                        len = (hdr.contentLengthB1 << 8) | hdr.contentLengthB0;
                        padding = hdr.paddingLength;
                }
+               if (safe_read(req, &hdr, sizeof(fcgi_header)) != 
sizeof(fcgi_header) ||
+                   hdr.version < FCGI_VERSION_1 ||
+                   hdr.type != FCGI_STDIN) {
+                       req->keep = 0;
+                       return 0;
+               }
+               req->in_len = (hdr.contentLengthB1 << 8) | hdr.contentLengthB0;
+               req->in_pad = hdr.paddingLength;
+               req->has_in = (req->in_len != 0);
        } else if (hdr.type == FCGI_GET_VALUES) {
                int i, j;
                int name_len;
@@ -551,6 +561,9 @@
        fcgi_header hdr;
        unsigned char buf[8];
 
+       if (!req->has_in) {
+               return 0;
+       }
        n = 0;
        rest = len;
        while (rest > 0) {
http://cvs.php.net/viewcvs.cgi/php-src/sapi/cgi/fastcgi.h?r1=1.2&r2=1.3&diff_format=u
Index: php-src/sapi/cgi/fastcgi.h
diff -u php-src/sapi/cgi/fastcgi.h:1.2 php-src/sapi/cgi/fastcgi.h:1.3
--- php-src/sapi/cgi/fastcgi.h:1.2      Sun Jan  1 13:09:57 2006
+++ php-src/sapi/cgi/fastcgi.h  Thu Apr 27 11:39:46 2006
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: fastcgi.h,v 1.2 2006/01/01 13:09:57 sniper Exp $ */
+/* $Id: fastcgi.h,v 1.3 2006/04/27 11:39:46 dmitry Exp $ */
 
 /* FastCGI protocol */
 
@@ -97,6 +97,7 @@
        int            id;
        int            keep;
 
+       int            has_in;
        int            in_len;
        int            in_pad;
 

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

Reply via email to