dmitry Thu May 25 07:06:04 2006 UTC Modified files: (Branch: PHP_5_1) /php-src NEWS /php-src/sapi/cgi fastcgi.c fastcgi.h Log: Fixed bug #37576 (FastCGI env (cgi vars) table overflow). (Piotr) http://cvs.php.net/viewcvs.cgi/php-src/NEWS?r1=1.2027.2.557&r2=1.2027.2.558&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.557 php-src/NEWS:1.2027.2.558 --- php-src/NEWS:1.2027.2.557 Thu May 25 06:40:21 2006 +++ php-src/NEWS Thu May 25 07:06:04 2006 @@ -1,6 +1,7 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2006, PHP 5.?.? +- Fixed bug #37576 (FastCGI env (cgi vars) table overflow). (Piotr) - Fixed bug #37496 (FastCGI output buffer overrun). (Piotr, Dmitry) - Fixed bug #37487 (oci_fetch_array() array-type should always default to OCI_BOTH). (Tony) http://cvs.php.net/viewcvs.cgi/php-src/sapi/cgi/fastcgi.c?r1=1.4.2.15&r2=1.4.2.16&diff_format=u Index: php-src/sapi/cgi/fastcgi.c diff -u php-src/sapi/cgi/fastcgi.c:1.4.2.15 php-src/sapi/cgi/fastcgi.c:1.4.2.16 --- php-src/sapi/cgi/fastcgi.c:1.4.2.15 Thu May 25 06:40:21 2006 +++ php-src/sapi/cgi/fastcgi.c Thu May 25 07:06:04 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: fastcgi.c,v 1.4.2.15 2006/05/25 06:40:21 dmitry Exp $ */ +/* $Id: fastcgi.c,v 1.4.2.16 2006/05/25 07:06:04 dmitry Exp $ */ #include "fastcgi.h" #include "php.h" @@ -401,7 +401,7 @@ int name_len, val_len; char *s; - while (p < end) { + while (p < end && n < FCGI_MAX_ENV_VARS - 1) { name_len = *p++; if (name_len >= 128) { name_len = ((name_len & 0x7f) << 24); @@ -424,10 +424,6 @@ p += val_len; s[name_len+1+val_len] = '\0'; n++; - if (n > sizeof(req->env)/sizeof(req->env[0])) { - /* TODO: to many environment variables */ - return n; - } } return n; } @@ -915,7 +911,9 @@ } env++; } - *env = fcgi_strndup(var, var_len); + if (env != &req->env[FCGI_MAX_ENV_VARS - 1]) { + *env = fcgi_strndup(var, var_len); + } } } http://cvs.php.net/viewcvs.cgi/php-src/sapi/cgi/fastcgi.h?r1=1.2.2.5&r2=1.2.2.6&diff_format=u Index: php-src/sapi/cgi/fastcgi.h diff -u php-src/sapi/cgi/fastcgi.h:1.2.2.5 php-src/sapi/cgi/fastcgi.h:1.2.2.6 --- php-src/sapi/cgi/fastcgi.h:1.2.2.5 Wed May 24 09:42:46 2006 +++ php-src/sapi/cgi/fastcgi.h Thu May 25 07:06:04 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: fastcgi.h,v 1.2.2.5 2006/05/24 09:42:46 dmitry Exp $ */ +/* $Id: fastcgi.h,v 1.2.2.6 2006/05/25 07:06:04 dmitry Exp $ */ /* FastCGI protocol */ @@ -26,6 +26,8 @@ #define FCGI_KEEP_CONN 1 +#define FCGI_MAX_ENV_VARS 256 + typedef enum _fcgi_role { FCGI_RESPONDER = 1, FCGI_AUTHORIZER = 2, @@ -105,7 +107,7 @@ unsigned char out_buf[1024*8]; unsigned char reserved[sizeof(fcgi_end_request_rec)]; - char *env[128]; + char *env[FCGI_MAX_ENV_VARS]; } fcgi_request; int fcgi_init(void);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php