iliaa Mon Dec 25 22:36:57 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/main main.c /php-src/ext/standard math.c /php-src/ext/soap php_encoding.c /php-src/ext/spl spl_directory.c /php-src/ext/pgsql pgsql.c Log: Allocation safety checks http://cvs.php.net/viewvc.cgi/php-src/main/main.c?r1=1.640.2.23.2.24&r2=1.640.2.23.2.25&diff_format=u Index: php-src/main/main.c diff -u php-src/main/main.c:1.640.2.23.2.24 php-src/main/main.c:1.640.2.23.2.25 --- php-src/main/main.c:1.640.2.23.2.24 Thu Dec 21 09:12:42 2006 +++ php-src/main/main.c Mon Dec 25 22:36:57 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: main.c,v 1.640.2.23.2.24 2006/12/21 09:12:42 dmitry Exp $ */ +/* $Id: main.c,v 1.640.2.23.2.25 2006/12/25 22:36:57 iliaa Exp $ */ /* {{{ includes */ @@ -100,8 +100,13 @@ */ static PHP_INI_MH(OnSetPrecision) { - EG(precision) = atoi(new_value); - return SUCCESS; + int i = atoi(new_value); + if (i >= 0) { + EG(precision) = i; + return SUCCESS; + } else { + return FAILURE; + } } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/standard/math.c?r1=1.131.2.2.2.3&r2=1.131.2.2.2.4&diff_format=u Index: php-src/ext/standard/math.c diff -u php-src/ext/standard/math.c:1.131.2.2.2.3 php-src/ext/standard/math.c:1.131.2.2.2.4 --- php-src/ext/standard/math.c:1.131.2.2.2.3 Fri Dec 22 04:03:15 2006 +++ php-src/ext/standard/math.c Mon Dec 25 22:36:57 2006 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: math.c,v 1.131.2.2.2.3 2006/12/22 04:03:15 iliaa Exp $ */ +/* $Id: math.c,v 1.131.2.2.2.4 2006/12/25 22:36:57 iliaa Exp $ */ #include "php.h" #include "php_math.h" @@ -976,7 +976,7 @@ dec = MAX(0, dec); PHP_ROUND_WITH_FUZZ(d, dec); - tmplen = spprintf(&tmpbuf, 0, "%.*f", dec, d); + tmplen = spprintf(&tmpbuf, 0, "%.*F", dec, d); if (tmpbuf == NULL || !isdigit((int)tmpbuf[0])) { return tmpbuf; http://cvs.php.net/viewvc.cgi/php-src/ext/soap/php_encoding.c?r1=1.103.2.21.2.18&r2=1.103.2.21.2.19&diff_format=u Index: php-src/ext/soap/php_encoding.c diff -u php-src/ext/soap/php_encoding.c:1.103.2.21.2.18 php-src/ext/soap/php_encoding.c:1.103.2.21.2.19 --- php-src/ext/soap/php_encoding.c:1.103.2.21.2.18 Tue Dec 19 11:54:38 2006 +++ php-src/ext/soap/php_encoding.c Mon Dec 25 22:36:57 2006 @@ -17,7 +17,7 @@ | Dmitry Stogov <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ */ -/* $Id: php_encoding.c,v 1.103.2.21.2.18 2006/12/19 11:54:38 dmitry Exp $ */ +/* $Id: php_encoding.c,v 1.103.2.21.2.19 2006/12/25 22:36:57 iliaa Exp $ */ #include <time.h> @@ -974,7 +974,7 @@ convert_to_double(&tmp); } - str = (char *) emalloc(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1); + str = (char *) safe_emalloc(EG(precision), 1, MAX_LENGTH_OF_DOUBLE + 1); php_gcvt(Z_DVAL(tmp), EG(precision), '.', 'E', str); xmlNodeSetContentLen(ret, BAD_CAST(str), strlen(str)); efree(str); http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.45.2.27.2.11&r2=1.45.2.27.2.12&diff_format=u Index: php-src/ext/spl/spl_directory.c diff -u php-src/ext/spl/spl_directory.c:1.45.2.27.2.11 php-src/ext/spl/spl_directory.c:1.45.2.27.2.12 --- php-src/ext/spl/spl_directory.c:1.45.2.27.2.11 Sun Nov 12 17:16:13 2006 +++ php-src/ext/spl/spl_directory.c Mon Dec 25 22:36:57 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_directory.c,v 1.45.2.27.2.11 2006/11/12 17:16:13 bjori Exp $ */ +/* $Id: spl_directory.c,v 1.45.2.27.2.12 2006/12/25 22:36:57 iliaa Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -1367,7 +1367,7 @@ } if (intern->u.file.max_line_len > 0) { - buf = emalloc((intern->u.file.max_line_len + 1) * sizeof(char)); + buf = safe_emalloc((intern->u.file.max_line_len + 1), sizeof(char), 0); if (php_stream_get_line(intern->u.file.stream, buf, intern->u.file.max_line_len, &line_len) == NULL) { efree(buf); buf = NULL; http://cvs.php.net/viewvc.cgi/php-src/ext/pgsql/pgsql.c?r1=1.331.2.13.2.11&r2=1.331.2.13.2.12&diff_format=u Index: php-src/ext/pgsql/pgsql.c diff -u php-src/ext/pgsql/pgsql.c:1.331.2.13.2.11 php-src/ext/pgsql/pgsql.c:1.331.2.13.2.12 --- php-src/ext/pgsql/pgsql.c:1.331.2.13.2.11 Wed Nov 29 15:45:58 2006 +++ php-src/ext/pgsql/pgsql.c Mon Dec 25 22:36:57 2006 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pgsql.c,v 1.331.2.13.2.11 2006/11/29 15:45:58 iliaa Exp $ */ +/* $Id: pgsql.c,v 1.331.2.13.2.12 2006/12/25 22:36:57 iliaa Exp $ */ #include <stdlib.h> @@ -2102,7 +2102,7 @@ Bucket *p; fci.param_count = 0; - fci.params = emalloc(sizeof(zval*) * ht->nNumOfElements); + fci.params = safe_emalloc(sizeof(zval*), ht->nNumOfElements, 0); p = ht->pListHead; while (p != NULL) { fci.params[fci.param_count++] = (zval**)p->pData;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php