[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard head.c
tony2001Mon Oct 16 19:27:57 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/standard head.c Log: MFH: initialize optional vars http://cvs.php.net/viewvc.cgi/php-src/ext/standard/head.c?r1=1.84.2.1.2.1&r2=1.84.2.1.2.2&diff_format=u Index: php-src/ext/standard/head.c diff -u php-src/ext/standard/head.c:1.84.2.1.2.1 php-src/ext/standard/head.c:1.84.2.1.2.2 --- php-src/ext/standard/head.c:1.84.2.1.2.1Thu Aug 10 13:50:56 2006 +++ php-src/ext/standard/head.c Mon Oct 16 19:27:57 2006 @@ -15,7 +15,7 @@ | Author: Rasmus Lerdorf <[EMAIL PROTECTED]>| +--+ */ -/* $Id: head.c,v 1.84.2.1.2.1 2006/08/10 13:50:56 iliaa Exp $ */ +/* $Id: head.c,v 1.84.2.1.2.2 2006/10/16 19:27:57 tony2001 Exp $ */ #include #include "php.h" @@ -152,7 +152,7 @@ char *name, *value = NULL, *path = NULL, *domain = NULL; long expires = 0; zend_bool secure = 0, httponly = 0; - int name_len, value_len, path_len, domain_len; + int name_len, value_len = 0, path_len = 0, domain_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slssbb", &name, &name_len, &value, &value_len, &expires, &path, @@ -175,7 +175,7 @@ char *name, *value = NULL, *path = NULL, *domain = NULL; long expires = 0; zend_bool secure = 0, httponly = 0; - int name_len, value_len, path_len, domain_len; + int name_len, value_len = 0, path_len = 0, domain_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slssbb", &name, &name_len, &value, &value_len, &expires, &path, -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard head.c
tony2001Mon Oct 16 19:27:00 2006 UTC Modified files: /php-src/ext/standard head.c Log: initialize optional variables http://cvs.php.net/viewvc.cgi/php-src/ext/standard/head.c?r1=1.89&r2=1.90&diff_format=u Index: php-src/ext/standard/head.c diff -u php-src/ext/standard/head.c:1.89 php-src/ext/standard/head.c:1.90 --- php-src/ext/standard/head.c:1.89Thu Aug 10 13:56:54 2006 +++ php-src/ext/standard/head.c Mon Oct 16 19:27:00 2006 @@ -15,7 +15,7 @@ | Author: Rasmus Lerdorf <[EMAIL PROTECTED]>| +--+ */ -/* $Id: head.c,v 1.89 2006/08/10 13:56:54 iliaa Exp $ */ +/* $Id: head.c,v 1.90 2006/10/16 19:27:00 tony2001 Exp $ */ #include #include "php.h" @@ -151,7 +151,7 @@ char *name, *value = NULL, *path = NULL, *domain = NULL; long expires = 0; zend_bool secure = 0, httponly = 0; - int name_len, value_len, path_len, domain_len; + int name_len, value_len = 0, path_len = 0, domain_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slssbb", &name, &name_len, &value, &value_len, &expires, &path, @@ -174,7 +174,7 @@ char *name, *value = NULL, *path = NULL, *domain = NULL; long expires = 0; zend_bool secure = 0, httponly = 0; - int name_len, value_len, path_len, domain_len; + int name_len, value_len = 0, path_len = 0, domain_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slssbb", &name, &name_len, &value, &value_len, &expires, &path, -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] CVS update: yahoo/packages/yahoo/php_ext/yahoo_libxml2 Makefile ...
[resending Rasmus's email as Xiaoxi is not on php-cvs] On Sun, 15 Oct 2006, Xiaoxi Liu wrote: CVSROOT:/CVSROOT Module name:yahoo Changes by: [EMAIL PROTECTED] 2006-10-15 19:03:52 Added files: packages/yahoo/php_ext/yahoo_libxml2: Makefile config.m4 php_yahoo_libxml2.h yahoo_libxml2.c yahoo_libxml2.php Log message: php extension For libmxl2 What is this supposed to be? We have all sorts of extensions for libxml2 already. Was there something missing in the existing ones? -Rasmus -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/json json.c
andrei Mon Oct 16 17:04:51 2006 UTC Modified files: /php-src/ext/json json.c Log: Patch to support primitive types. (Ilia) http://cvs.php.net/viewvc.cgi/php-src/ext/json/json.c?r1=1.14&r2=1.15&diff_format=u Index: php-src/ext/json/json.c diff -u php-src/ext/json/json.c:1.14 php-src/ext/json/json.c:1.15 --- php-src/ext/json/json.c:1.14Sat Jul 22 15:23:23 2006 +++ php-src/ext/json/json.c Mon Oct 16 17:04:51 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: json.c,v 1.14 2006/07/22 15:23:23 nlopess Exp $ */ +/* $Id: json.c,v 1.15 2006/10/16 17:04:51 andrei Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -446,10 +446,35 @@ } else { + double d; + int type; + long p; + zval_dtor(z); FREE_ZVAL(z); efree(utf16); -RETURN_NULL(); + + if (parameter_len == 4) { + if (!strcasecmp(parameter, "null")) { + RETURN_NULL(); + } else if (!strcasecmp(parameter, "true")) { + RETURN_BOOL(1); + } + } else if (parameter_len == 5 && !strcasecmp(parameter, "false")) { + RETURN_BOOL(0); + } + if ((type = is_numeric_string(parameter, parameter_len, &p, &d, 0)) != 0) { + if (type == IS_LONG) { + RETURN_LONG(p); + } else if (type == IS_DOUBLE) { + RETURN_DOUBLE(d); + } + } + if (*parameter == '"' || parameter[parameter_len] == '"') { + RETURN_STRINGL(parameter+1, parameter_len-2, 1); + } else { + RETURN_STRINGL(parameter, parameter_len, 1); + } } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/zlib zlib_filter.c
iliaa Mon Oct 16 15:42:23 2006 UTC Modified files: /php-src/ext/zlib zlib_filter.c Log: MFB: Fixed compiler warnings http://cvs.php.net/viewvc.cgi/php-src/ext/zlib/zlib_filter.c?r1=1.12&r2=1.13&diff_format=u Index: php-src/ext/zlib/zlib_filter.c diff -u php-src/ext/zlib/zlib_filter.c:1.12 php-src/ext/zlib/zlib_filter.c:1.13 --- php-src/ext/zlib/zlib_filter.c:1.12 Sun Oct 8 13:34:24 2006 +++ php-src/ext/zlib/zlib_filter.c Mon Oct 16 15:42:23 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: zlib_filter.c,v 1.12 2006/10/08 13:34:24 bjori Exp $ */ +/* $Id: zlib_filter.c,v 1.13 2006/10/16 15:42:23 iliaa Exp $ */ #include "php.h" #include "php_zlib.h" @@ -292,7 +292,7 @@ /* Create this filter */ data = pecalloc(1, sizeof(php_zlib_filter_data), persistent); if (!data) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed allocating %ld bytes", sizeof(php_zlib_filter_data)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed allocating %zd bytes", sizeof(php_zlib_filter_data)); return NULL; } @@ -304,14 +304,14 @@ data->strm.avail_out = data->outbuf_len = data->inbuf_len = 2048; data->strm.next_in = data->inbuf = (Bytef *) pemalloc(data->inbuf_len, persistent); if (!data->inbuf) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed allocating %ld bytes", data->inbuf_len); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed allocating %zd bytes", data->inbuf_len); pefree(data, persistent); return NULL; } data->strm.avail_in = 0; data->strm.next_out = data->outbuf = (Bytef *) pemalloc(data->outbuf_len, persistent); if (!data->outbuf) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed allocating %ld bytes", data->outbuf_len); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed allocating %zd bytes", data->outbuf_len); pefree(data->inbuf, persistent); pefree(data, persistent); return NULL; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/zlib zlib_filter.c
iliaa Mon Oct 16 15:39:39 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/zlib zlib_filter.c Log: Fixed compiler warnings http://cvs.php.net/viewvc.cgi/php-src/ext/zlib/zlib_filter.c?r1=1.6.2.2.2.1&r2=1.6.2.2.2.2&diff_format=u Index: php-src/ext/zlib/zlib_filter.c diff -u php-src/ext/zlib/zlib_filter.c:1.6.2.2.2.1 php-src/ext/zlib/zlib_filter.c:1.6.2.2.2.2 --- php-src/ext/zlib/zlib_filter.c:1.6.2.2.2.1 Mon Jun 12 23:28:32 2006 +++ php-src/ext/zlib/zlib_filter.c Mon Oct 16 15:39:39 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: zlib_filter.c,v 1.6.2.2.2.1 2006/06/12 23:28:32 iliaa Exp $ */ +/* $Id: zlib_filter.c,v 1.6.2.2.2.2 2006/10/16 15:39:39 iliaa Exp $ */ #include "php.h" #include "php_zlib.h" @@ -275,7 +275,7 @@ /* Create this filter */ data = pecalloc(1, sizeof(php_zlib_filter_data), persistent); if (!data) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed allocating %ld bytes.", sizeof(php_zlib_filter_data)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed allocating %zd bytes.", sizeof(php_zlib_filter_data)); return NULL; } @@ -287,14 +287,14 @@ data->strm.avail_out = data->outbuf_len = data->inbuf_len = 2048; data->strm.next_in = data->inbuf = (Bytef *) pemalloc(data->inbuf_len, persistent); if (!data->inbuf) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed allocating %ld bytes.", data->inbuf_len); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed allocating %zd bytes.", data->inbuf_len); pefree(data, persistent); return NULL; } data->strm.avail_in = 0; data->strm.next_out = data->outbuf = (Bytef *) pemalloc(data->outbuf_len, persistent); if (!data->outbuf) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed allocating %ld bytes.", data->outbuf_len); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed allocating %zd bytes.", data->outbuf_len); pefree(data->inbuf, persistent); pefree(data, persistent); return NULL; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /sapi/cgi fastcgi.c
dmitry Mon Oct 16 10:47:23 2006 UTC Modified files: /php-src/sapi/cgi fastcgi.c Log: Fixed bug #39020 (PHP in FastCGI server mode crashes) http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/fastcgi.c?r1=1.24&r2=1.25&diff_format=u Index: php-src/sapi/cgi/fastcgi.c diff -u php-src/sapi/cgi/fastcgi.c:1.24 php-src/sapi/cgi/fastcgi.c:1.25 --- php-src/sapi/cgi/fastcgi.c:1.24 Wed Sep 13 13:03:14 2006 +++ php-src/sapi/cgi/fastcgi.c Mon Oct 16 10:47:23 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: fastcgi.c,v 1.24 2006/09/13 13:03:14 dmitry Exp $ */ +/* $Id: fastcgi.c,v 1.25 2006/10/16 10:47:23 dmitry Exp $ */ #include "php.h" #include "fastcgi.h" @@ -390,13 +390,14 @@ return pad; } -static void fcgi_get_params(fcgi_request *req, unsigned char *p, unsigned char *end) +static int fcgi_get_params(fcgi_request *req, unsigned char *p, unsigned char *end) { char buf[128]; char *tmp = buf; int buf_size = sizeof(buf); int name_len, val_len; char *s; + int ret = 1; while (p < end) { name_len = *p++; @@ -413,6 +414,11 @@ val_len |= (*p++ << 8); val_len |= *p++; } + if (p + name_len + val_len > end) { + /* Malformated request */ + ret = 0; + break; + } if (name_len+1 >= buf_size) { buf_size = name_len + 64; tmp = (tmp == buf ? emalloc(buf_size): erealloc(tmp, buf_size)); @@ -426,6 +432,7 @@ if (tmp != buf && tmp != NULL) { efree(tmp); } + return ret; } static void fcgi_free_var(char **s) @@ -503,7 +510,11 @@ req->keep = 0; return 0; } - fcgi_get_params(req, buf, buf+len); + + if (!fcgi_get_params(req, buf, buf+len)) { + req->keep = 0; + return 0; + } if (safe_read(req, &hdr, sizeof(fcgi_header)) != sizeof(fcgi_header) || hdr.version < FCGI_VERSION_1) { @@ -518,9 +529,14 @@ unsigned char *p = buf + sizeof(fcgi_header); if (safe_read(req, buf, len+padding) != len+padding) { + req->keep = 0; + return 0; + } + + if (!fcgi_get_params(req, buf, buf+len)) { + req->keep = 0; return 0; } - fcgi_get_params(req, buf, buf+len); for (j = 0; j < sizeof(fcgi_mgmt_vars)/sizeof(fcgi_mgmt_vars[0]); j++) { if (zend_hash_exists(&req->env, fcgi_mgmt_vars[j].name, fcgi_mgmt_vars[j].name_len+1) == 0) { @@ -531,6 +547,7 @@ len = p - buf - sizeof(fcgi_header); len += fcgi_make_header((fcgi_header*)buf, FCGI_GET_VALUES_RESULT, 0, len); if (safe_write(req, buf, sizeof(fcgi_header)+len) != (int)sizeof(fcgi_header)+len) { + req->keep = 0; return 0; } return 0; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /sapi/cgi fastcgi.c
dmitry Mon Oct 16 10:46:59 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi fastcgi.c /php-srcNEWS Log: Fixed bug #39020 (PHP in FastCGI server mode crashes) http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/fastcgi.c?r1=1.4.2.13.2.10&r2=1.4.2.13.2.11&diff_format=u Index: php-src/sapi/cgi/fastcgi.c diff -u php-src/sapi/cgi/fastcgi.c:1.4.2.13.2.10 php-src/sapi/cgi/fastcgi.c:1.4.2.13.2.11 --- php-src/sapi/cgi/fastcgi.c:1.4.2.13.2.10Wed Sep 13 13:03:01 2006 +++ php-src/sapi/cgi/fastcgi.c Mon Oct 16 10:46:59 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: fastcgi.c,v 1.4.2.13.2.10 2006/09/13 13:03:01 dmitry Exp $ */ +/* $Id: fastcgi.c,v 1.4.2.13.2.11 2006/10/16 10:46:59 dmitry Exp $ */ #include "php.h" #include "fastcgi.h" @@ -390,13 +390,14 @@ return pad; } -static void fcgi_get_params(fcgi_request *req, unsigned char *p, unsigned char *end) +static int fcgi_get_params(fcgi_request *req, unsigned char *p, unsigned char *end) { char buf[128]; char *tmp = buf; int buf_size = sizeof(buf); int name_len, val_len; char *s; + int ret = 1; while (p < end) { name_len = *p++; @@ -413,6 +414,11 @@ val_len |= (*p++ << 8); val_len |= *p++; } + if (p + name_len + val_len > end) { + /* Malformated request */ + ret = 0; + break; + } if (name_len+1 >= buf_size) { buf_size = name_len + 64; tmp = (tmp == buf ? emalloc(buf_size): erealloc(tmp, buf_size)); @@ -426,6 +432,7 @@ if (tmp != buf && tmp != NULL) { efree(tmp); } + return ret; } static void fcgi_free_var(char **s) @@ -503,7 +510,11 @@ req->keep = 0; return 0; } - fcgi_get_params(req, buf, buf+len); + + if (!fcgi_get_params(req, buf, buf+len)) { + req->keep = 0; + return 0; + } if (safe_read(req, &hdr, sizeof(fcgi_header)) != sizeof(fcgi_header) || hdr.version < FCGI_VERSION_1) { @@ -518,9 +529,14 @@ unsigned char *p = buf + sizeof(fcgi_header); if (safe_read(req, buf, len+padding) != len+padding) { + req->keep = 0; + return 0; + } + + if (!fcgi_get_params(req, buf, buf+len)) { + req->keep = 0; return 0; } - fcgi_get_params(req, buf, buf+len); for (j = 0; j < sizeof(fcgi_mgmt_vars)/sizeof(fcgi_mgmt_vars[0]); j++) { if (zend_hash_exists(&req->env, fcgi_mgmt_vars[j].name, fcgi_mgmt_vars[j].name_len+1) == 0) { @@ -531,6 +547,7 @@ len = p - buf - sizeof(fcgi_header); len += fcgi_make_header((fcgi_header*)buf, FCGI_GET_VALUES_RESULT, 0, len); if (safe_write(req, buf, sizeof(fcgi_header)+len) != (int)sizeof(fcgi_header)+len) { + req->keep = 0; return 0; } return 0; http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.305&r2=1.2027.2.547.2.306&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.305 php-src/NEWS:1.2027.2.547.2.306 --- php-src/NEWS:1.2027.2.547.2.305 Fri Oct 13 01:42:20 2006 +++ php-src/NEWSMon Oct 16 10:46:59 2006 @@ -3,6 +3,7 @@ 12 Oct 2006, PHP 5.2.0RC6 - Fixed invalid read in imagecreatefrompng when an empty file is given (Pierre, Tony) +- Fixed bug #39020 (PHP in FastCGI server mode crashes). (Dmitry) - Fixed bug #38458, PECL bug #8944, PECL bug #7775 (error retrieving columns after long/text columns with PDO_ODBC). (Wez) - Fixed PECL bug #8816 (issue in php_oci_statement_fetch with more than one -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php