Re: cvs: php-src(PHP_5_1) /sapi/cgi fastcgi.c fastcgi.h

From: Date: Fri, 28 Apr 2006 13:40:56 +0000
Subject: Re: cvs: php-src(PHP_5_1) /sapi/cgi fastcgi.c fastcgi.h
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-37946@lists.php.net to get a copy of this message
Dmitry, So we need to re-tag with this patch? On 27-Apr-06, at 7:39 AM, Dmitry Stogov wrote:
dmitry Thu Apr 27 11:39:32 2006 UTC
  Modified files:              (Branch: PHP_5_1)
    /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.4.2.9&r2=1.4.2.10&diff_format=u Index: php-src/sapi/cgi/fastcgi.c diff -u php-src/sapi/cgi/fastcgi.c:1.4.2.9 php-src/sapi/cgi/fastcgi.c:1.4.2.10 --- php-src/sapi/cgi/fastcgi.c:1.4.2.9 Wed Apr 26 17:48:27 2006 +++ php-src/sapi/cgi/fastcgi.c Thu Apr 27 11:39:32 2006 @@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
*/ -/* $Id: fastcgi.c,v 1.4.2.9 2006/04/26 17:48:27 dmitry Exp $ */ +/* $Id: fastcgi.c,v 1.4.2.10 2006/04/27 11:39:32 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.2.2&r2=1.2.2.3&diff_format=u Index: php-src/sapi/cgi/fastcgi.h diff -u php-src/sapi/cgi/fastcgi.h:1.2.2.2 php-src/sapi/cgi/fastcgi.h:1.2.2.3 --- php-src/sapi/cgi/fastcgi.h:1.2.2.2 Thu Feb 2 08:17:23 2006 +++ php-src/sapi/cgi/fastcgi.h Thu Apr 27 11:39:32 2006 @@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
*/ -/* $Id: fastcgi.h,v 1.2.2.2 2006/02/02 08:17:23 dmitry Exp $ */ +/* $Id: fastcgi.h,v 1.2.2.3 2006/04/27 11:39:32 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
Ilia Alshanetsky Advanced Internet Designs Inc. ilia@prohost.org

« previous php.cvs (#37946) next »