iliaa Mon Aug 11 20:55:59 2003 EDT Modified files: /php-src/ext/xml xml.c /php-src/ext/xsl xsltprocessor.c /php-src/ext/wddx wddx.c /php-src/ext/w32api w32api.c /php-src/ext/sybase_ct php_sybase_ct.c /php-src/ext/sybase php_sybase_db.c /php-src/ext/sockets sockets.c /php-src/ext/session session.c /php-src/ext/pfpro pfpro.c /php-src/ext/ovrimos ovrimos.c /php-src/ext/oracle oracle.c /php-src/ext/mysqli mysqli_profiler.c mysqli_api.c /php-src/ext/mysql php_mysql.c /php-src/ext/odbc php_odbc.c /php-src/ext/mssql php_mssql.c /php-src/ext/msession msession.c /php-src/ext/mono php_mono.c /php-src/ext/oci8 oci8.c /php-src/ext/interbase interbase.c /php-src/ext/ingres_ii ii.c /php-src/ext/imap php_imap.c /php-src/ext/gd/libgd gd.c /php-src/ext/gd gd.c /php-src/ext/ftp ftp.c /php-src/ext/fbsql php_fbsql.c /php-src/ext/dom element.c document.c /php-src/ext/db db.c Log: emalloc -> safe_emalloc
Index: php-src/ext/xml/xml.c diff -u php-src/ext/xml/xml.c:1.138 php-src/ext/xml/xml.c:1.139 --- php-src/ext/xml/xml.c:1.138 Tue Aug 5 06:29:03 2003 +++ php-src/ext/xml/xml.c Mon Aug 11 20:55:55 2003 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: xml.c,v 1.138 2003/08/05 10:29:03 zeev Exp $ */ +/* $Id: xml.c,v 1.139 2003/08/12 00:55:55 iliaa Exp $ */ #define IS_EXT_MODULE @@ -408,7 +408,7 @@ int result; zend_fcall_info fci; - args = emalloc(sizeof(zval **) * argc); + args = safe_emalloc(sizeof(zval **), argc, 0); for (i = 0; i < argc; i++) { args[i] = &argv[i]; } @@ -525,7 +525,7 @@ } /* This is the theoretical max (will never get beyond len * 2 as long * as we are converting from single-byte characters, though) */ - newbuf = emalloc(len * 4 + 1); + newbuf = safe_emalloc(len, 4, 1); while (pos > 0) { c = encoder ? encoder((unsigned char)(*s)) : (unsigned short)(*s); if (c < 0x80) { @@ -1368,7 +1368,7 @@ if (info) parser->info = *info; parser->level = 0; - parser->ltags = emalloc(XML_MAXLEVEL * sizeof(char *)); + parser->ltags = safe_emalloc(XML_MAXLEVEL, sizeof(char *), 0); XML_SetDefaultHandler(parser->parser, _xml_defaultHandler); XML_SetElementHandler(parser->parser, _xml_startElementHandler, _xml_endElementHandler); Index: php-src/ext/xsl/xsltprocessor.c diff -u php-src/ext/xsl/xsltprocessor.c:1.9 php-src/ext/xsl/xsltprocessor.c:1.10 --- php-src/ext/xsl/xsltprocessor.c:1.9 Thu Aug 7 14:38:39 2003 +++ php-src/ext/xsl/xsltprocessor.c Mon Aug 11 20:55:55 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: xsltprocessor.c,v 1.9 2003/08/07 18:38:39 rrichards Exp $ */ +/* $Id: xsltprocessor.c,v 1.10 2003/08/12 00:55:55 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -62,10 +62,10 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create XPath expression (string contains both quote and double-quotes)"); return NULL; } - value = (xmlChar*) emalloc (str_len * sizeof(xmlChar) ); + value = (xmlChar*) safe_emalloc (str_len, sizeof(xmlChar), 0); snprintf(value, str_len, "'%s'", string); } else { - value = (xmlChar*) emalloc (str_len * sizeof(xmlChar) ); + value = (xmlChar*) safe_emalloc (str_len, sizeof(xmlChar), 0); snprintf(value, str_len, "\"%s\"", string); } return (char *) value; Index: php-src/ext/wddx/wddx.c diff -u php-src/ext/wddx/wddx.c:1.106 php-src/ext/wddx/wddx.c:1.107 --- php-src/ext/wddx/wddx.c:1.106 Sat Jun 28 02:55:46 2003 +++ php-src/ext/wddx/wddx.c Mon Aug 11 20:55:55 2003 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: wddx.c,v 1.106 2003/06/28 06:55:46 iliaa Exp $ */ +/* $Id: wddx.c,v 1.107 2003/08/12 00:55:55 iliaa Exp $ */ #include "php.h" @@ -140,7 +140,7 @@ static int wddx_stack_init(wddx_stack *stack) { stack->top = 0; - stack->elements = (void **) emalloc(sizeof(void **) * STACK_BLOCK_SIZE); + stack->elements = (void **) safe_emalloc(sizeof(void **), STACK_BLOCK_SIZE, 0); stack->max = STACK_BLOCK_SIZE; stack->varname = NULL; stack->done = 0; @@ -1158,7 +1158,7 @@ } /* Allocate arguments array and get the arguments, checking for errors. */ - args = (zval ***)emalloc(argc * sizeof(zval **)); + args = (zval ***)safe_emalloc(argc, sizeof(zval **), 0); if (zend_get_parameters_array_ex(argc, args) == FAILURE) { efree(args); WRONG_PARAM_COUNT; @@ -1267,7 +1267,7 @@ } /* Allocate arguments array and get the arguments, checking for errors. */ - args = (zval ***)emalloc(argc * sizeof(zval **)); + args = (zval ***)safe_emalloc(argc, sizeof(zval **), 0); if (zend_get_parameters_array_ex(argc, args) == FAILURE) { efree(args); WRONG_PARAM_COUNT; Index: php-src/ext/w32api/w32api.c diff -u php-src/ext/w32api/w32api.c:1.11 php-src/ext/w32api/w32api.c:1.12 --- php-src/ext/w32api/w32api.c:1.11 Tue Jun 10 16:03:40 2003 +++ php-src/ext/w32api/w32api.c Mon Aug 11 20:55:55 2003 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: w32api.c,v 1.11 2003/06/10 20:03:40 imajes Exp $ */ +/* $Id: w32api.c,v 1.12 2003/08/12 00:55:55 iliaa Exp $ */ /* * Win32 API Extension for PHP 4 @@ -894,7 +894,7 @@ if( j == 0 ) return NULL; - retval = (unsigned char *)emalloc(sizeof(unsigned char) * j + 1); + retval = (unsigned char *)safe_emalloc(sizeof(unsigned char), j, 1); retval[0] = (unsigned char)j; curr_arg = *argument_list; @@ -1022,7 +1022,7 @@ object_init_ex(obj, WG(type_ce)); ti->type = th; - ti->values = emalloc(sizeof(zval *) * th->member_count); + ti->values = safe_emalloc(sizeof(zval *), th->member_count, 0); memset(ti->values, '\0', sizeof(zval *) * th->member_count); MAKE_STD_ZVAL(rsrc_handle); @@ -1666,7 +1666,7 @@ WRONG_PARAM_COUNT } - params = (w32api_dynamic_param *)emalloc(sizeof(w32api_dynamic_param) * argc); + params = (w32api_dynamic_param *)safe_emalloc(sizeof(w32api_dynamic_param), argc, 0); curr_arg = (*fh)->argument_list; current_dynamic_param = params; Index: php-src/ext/sybase_ct/php_sybase_ct.c diff -u php-src/ext/sybase_ct/php_sybase_ct.c:1.83 php-src/ext/sybase_ct/php_sybase_ct.c:1.84 --- php-src/ext/sybase_ct/php_sybase_ct.c:1.83 Tue Jun 10 16:03:39 2003 +++ php-src/ext/sybase_ct/php_sybase_ct.c Mon Aug 11 20:55:55 2003 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_sybase_ct.c,v 1.83 2003/06/10 20:03:39 imajes Exp $ */ +/* $Id: php_sybase_ct.c,v 1.84 2003/08/12 00:55:55 iliaa Exp $ */ #ifdef HAVE_CONFIG_H @@ -1042,7 +1042,7 @@ result->data = (zval **) erealloc(result->data, sizeof(zval *)*SYBASE_ROWS_BLOCK*(++result->blocks_initialized)); } if (result->store || 1 == result->num_rows) { - result->data[i] = (zval *) emalloc(sizeof(zval)*result->num_fields); + result->data[i] = (zval *) safe_emalloc(sizeof(zval), result->num_fields, 0); } for (j=0; j<result->num_fields; j++) { @@ -1103,7 +1103,7 @@ } result = (sybase_result *) emalloc(sizeof(sybase_result)); - result->data = (zval **) emalloc(sizeof(zval *)*SYBASE_ROWS_BLOCK); + result->data = (zval **) safe_emalloc(sizeof(zval *), SYBASE_ROWS_BLOCK, 0); result->fields = NULL; result->sybase_ptr = sybase_ptr; result->cur_field=result->cur_row=result->num_rows=0; @@ -1111,12 +1111,12 @@ result->last_retcode = 0; result->store= store; result->blocks_initialized= 1; - result->tmp_buffer = (char **) emalloc(sizeof(char *)*num_fields); - result->lengths = (CS_INT *) emalloc(sizeof(CS_INT)*num_fields); - result->indicators = (CS_SMALLINT *) emalloc(sizeof(CS_INT)*num_fields); - result->datafmt = (CS_DATAFMT *) emalloc(sizeof(CS_DATAFMT)*num_fields); - result->numerics = (unsigned char *) emalloc(sizeof(unsigned char)*num_fields); - result->types = (CS_INT *) emalloc(sizeof(CS_INT)*num_fields); + result->tmp_buffer = (char **) safe_emalloc(sizeof(char *), num_fields, 0); + result->lengths = (CS_INT *) safe_emalloc(sizeof(CS_INT), num_fields, 0); + result->indicators = (CS_SMALLINT *) safe_emalloc(sizeof(CS_INT), num_fields, 0); + result->datafmt = (CS_DATAFMT *) safe_emalloc(sizeof(CS_DATAFMT), num_fields, 0); + result->numerics = (unsigned char *) safe_emalloc(sizeof(unsigned char), num_fields, 0); + result->types = (CS_INT *) safe_emalloc(sizeof(CS_INT), num_fields, 0); for (i=0; i<num_fields; i++) { ct_describe(sybase_ptr->cmd, i+1, &result->datafmt[i]); @@ -1180,7 +1180,7 @@ ct_bind(sybase_ptr->cmd, i+1, &result->datafmt[i], result->tmp_buffer[i], &result->lengths[i], &result->indicators[i]); } - result->fields = (sybase_field *) emalloc(sizeof(sybase_field)*num_fields); + result->fields = (sybase_field *) safe_emalloc(sizeof(sybase_field), num_fields, 0); j=0; for (i=0; i<num_fields; i++) { char computed_buf[16]; @@ -2038,7 +2038,7 @@ WRONG_PARAM_COUNT; } - params = emalloc(sizeof(zval **) * argc); + params = safe_emalloc(sizeof(zval **), argc, 0); if (zend_get_parameters_array_ex(argc, params) == FAILURE) { efree(params); Index: php-src/ext/sybase/php_sybase_db.c diff -u php-src/ext/sybase/php_sybase_db.c:1.52 php-src/ext/sybase/php_sybase_db.c:1.53 --- php-src/ext/sybase/php_sybase_db.c:1.52 Tue Aug 5 12:02:11 2003 +++ php-src/ext/sybase/php_sybase_db.c Mon Aug 11 20:55:55 2003 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_sybase_db.c,v 1.52 2003/08/05 16:02:11 sniper Exp $ */ +/* $Id: php_sybase_db.c,v 1.53 2003/08/12 00:55:55 iliaa Exp $ */ #ifdef HAVE_CONFIG_H @@ -827,13 +827,13 @@ RETURN_TRUE; } - column_types = (int *) emalloc(sizeof(int) * num_fields); + column_types = (int *) safe_emalloc(sizeof(int), num_fields, 0); for (i=0; i<num_fields; i++) { column_types[i] = coltype(i+1); } result = (sybase_result *) emalloc(sizeof(sybase_result)); - result->data = (pval ***) emalloc(sizeof(pval **)*SYBASE_ROWS_BLOCK); + result->data = (pval ***) safe_emalloc(sizeof(pval **), SYBASE_ROWS_BLOCK, 0); result->sybase_ptr = sybase_ptr; result->cur_field=result->cur_row=result->num_rows=0; result->num_fields = num_fields; @@ -844,7 +844,7 @@ if (result->num_rows > blocks_initialized*SYBASE_ROWS_BLOCK) { result->data = (pval ***) erealloc(result->data,sizeof(pval **)*SYBASE_ROWS_BLOCK*(++blocks_initialized)); } - result->data[i] = (pval **) emalloc(sizeof(pval *)*num_fields); + result->data[i] = (pval **) safe_emalloc(sizeof(pval *), num_fields, 0); for (j=1; j<=num_fields; j++) { php_sybase_get_column_content(sybase_ptr, j, &result->data[i][j-1], column_types[j-1]); if (!php_sybase_module.compatability_mode) { @@ -862,7 +862,7 @@ } result->num_rows = DBCOUNT(sybase_ptr->link); - result->fields = (sybase_field *) emalloc(sizeof(sybase_field)*num_fields); + result->fields = (sybase_field *) safe_emalloc(sizeof(sybase_field), num_fields, 0); j=0; for (i=0; i<num_fields; i++) { char *fname = dbcolname(sybase_ptr->link,i+1); Index: php-src/ext/sockets/sockets.c diff -u php-src/ext/sockets/sockets.c:1.149 php-src/ext/sockets/sockets.c:1.150 --- php-src/ext/sockets/sockets.c:1.149 Sun Aug 3 14:55:51 2003 +++ php-src/ext/sockets/sockets.c Mon Aug 11 20:55:55 2003 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: sockets.c,v 1.149 2003/08/03 18:55:51 helly Exp $ */ +/* $Id: sockets.c,v 1.150 2003/08/12 00:55:55 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1267,7 +1267,7 @@ struct iovec *vector_array; int i, j, num_vectors, argc = ZEND_NUM_ARGS(); - args = emalloc(argc*sizeof(zval**)); + args = safe_emalloc(argc, sizeof(zval**), 0); if (argc < 1 || zend_get_parameters_array_ex(argc, args) == FAILURE) { efree(args); @@ -1277,7 +1277,7 @@ convert_to_long_ex(args[0]); num_vectors = Z_LVAL_PP(args[0]); - vector_array = emalloc(sizeof(struct iovec)*(num_vectors+1)); + vector_array = safe_emalloc(sizeof(struct iovec), (num_vectors+1), 0); for (i = 0, j = 1; i < num_vectors; i++, j++) { convert_to_long_ex(args[j]); @@ -1363,7 +1363,7 @@ ZEND_FETCH_RESOURCE(vector, php_iovec_t *, &iovec_id, -1, le_iov_name, le_iov); - vector_array = (struct iovec*)emalloc(sizeof(struct iovec) * (vector->count + 2)); + vector_array = (struct iovec*)safe_emalloc(sizeof(struct iovec), (vector->count + 2), 0); memcpy(vector_array, vector->iov_array, sizeof(struct iovec) * vector->count); vector_array[vector->count].iov_base = (char*)emalloc(iov_len); @@ -1397,7 +1397,7 @@ RETURN_FALSE; } - vector_array = emalloc(vector->count * sizeof(struct iovec)); + vector_array = safe_emalloc(vector->count, sizeof(struct iovec), 0); for (i = 0; i < vector->count; i++) { if (i < iov_pos) { Index: php-src/ext/session/session.c diff -u php-src/ext/session/session.c:1.369 php-src/ext/session/session.c:1.370 --- php-src/ext/session/session.c:1.369 Mon Aug 11 15:20:44 2003 +++ php-src/ext/session/session.c Mon Aug 11 20:55:56 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: session.c,v 1.369 2003/08/11 19:20:44 iliaa Exp $ */ +/* $Id: session.c,v 1.370 2003/08/12 00:55:56 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1468,7 +1468,7 @@ if (argc <= 0) RETURN_FALSE else - args = (zval ***)emalloc(argc * sizeof(zval **)); + args = (zval ***)safe_emalloc(argc, sizeof(zval **), 0); if (zend_get_parameters_array_ex(argc, args) == FAILURE) { efree(args); Index: php-src/ext/pfpro/pfpro.c diff -u php-src/ext/pfpro/pfpro.c:1.30 php-src/ext/pfpro/pfpro.c:1.31 --- php-src/ext/pfpro/pfpro.c:1.30 Sat Jul 19 15:23:32 2003 +++ php-src/ext/pfpro/pfpro.c Mon Aug 11 20:55:56 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pfpro.c,v 1.30 2003/07/19 19:23:32 andrey Exp $ */ +/* $Id: pfpro.c,v 1.31 2003/08/12 00:55:56 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -208,7 +208,7 @@ WRONG_PARAM_COUNT; } - args = (zval ***) emalloc(sizeof(zval **) * ZEND_NUM_ARGS()); + args = (zval ***) safe_emalloc(sizeof(zval **), ZEND_NUM_ARGS(), 0); if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to read parameters in pfpro_process_raw()"); @@ -325,7 +325,7 @@ WRONG_PARAM_COUNT; } - args = (zval ***) emalloc(sizeof(zval **) * ZEND_NUM_ARGS()); + args = (zval ***) safe_emalloc(sizeof(zval **), ZEND_NUM_ARGS(), 0); if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to read parameters in pfpro_process()"); Index: php-src/ext/ovrimos/ovrimos.c diff -u php-src/ext/ovrimos/ovrimos.c:1.24 php-src/ext/ovrimos/ovrimos.c:1.25 --- php-src/ext/ovrimos/ovrimos.c:1.24 Sun Jun 22 10:33:03 2003 +++ php-src/ext/ovrimos/ovrimos.c Mon Aug 11 20:55:56 2003 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: ovrimos.c,v 1.24 2003/06/22 14:33:03 andrey Exp $ */ +/* $Id: ovrimos.c,v 1.25 2003/08/12 00:55:56 iliaa Exp $ */ #include "php.h" #include "php_globals.h" @@ -212,7 +212,7 @@ return 1; } - new_statements = emalloc( (state->nstatements-1) * sizeof(STATEMENT)); + new_statements = safe_emalloc( (state->nstatements-1), sizeof(STATEMENT), 0); for (i=j=0;i<state->nstatements;i++) { if (state->statements->statement != stmt) { Index: php-src/ext/oracle/oracle.c diff -u php-src/ext/oracle/oracle.c:1.91 php-src/ext/oracle/oracle.c:1.92 --- php-src/ext/oracle/oracle.c:1.91 Sun Aug 3 13:44:37 2003 +++ php-src/ext/oracle/oracle.c Mon Aug 11 20:55:56 2003 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: oracle.c,v 1.91 2003/08/03 17:44:37 zeev Exp $ */ +/* $Id: oracle.c,v 1.92 2003/08/12 00:55:56 iliaa Exp $ */ /* comment out the next line if you're on Oracle 7.x and don't have the olog call. */ @@ -1650,7 +1650,7 @@ } if (cursor->ncols > 0){ - cursor->columns = (oraColumn *) emalloc(sizeof(oraColumn) * cursor->ncols); + cursor->columns = (oraColumn *) safe_emalloc(sizeof(oraColumn), cursor->ncols, 0); memset(cursor->columns,0,sizeof(oraColumn) * cursor->ncols); } Index: php-src/ext/mysqli/mysqli_profiler.c diff -u php-src/ext/mysqli/mysqli_profiler.c:1.7 php-src/ext/mysqli/mysqli_profiler.c:1.8 --- php-src/ext/mysqli/mysqli_profiler.c:1.7 Tue Jun 10 16:03:33 2003 +++ php-src/ext/mysqli/mysqli_profiler.c Mon Aug 11 20:55:56 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ - $Id: mysqli_profiler.c,v 1.7 2003/06/10 20:03:33 imajes Exp $ + $Id: mysqli_profiler.c,v 1.8 2003/08/12 00:55:56 iliaa Exp $ */ #ifdef HAVE_CONFIG_H @@ -104,8 +104,8 @@ explain->columns = mysql_num_fields(res); - explain->row = (PR_ROW *)emalloc(sizeof(PR_ROW) * explain->exp_cnt); - explain->fields = (char **)emalloc(sizeof(char *) * explain->columns); + explain->row = (PR_ROW *)safe_emalloc(sizeof(PR_ROW), explain->exp_cnt, 0); + explain->fields = (char **)safe_emalloc(sizeof(char *), explain->columns, 0); fields = mysql_fetch_fields(res); @@ -114,7 +114,7 @@ } for (i=0; i < explain->exp_cnt; i++) { - explain->row[i].value = (char **)emalloc(sizeof(char *) * explain->columns); + explain->row[i].value = (char **)safe_emalloc(sizeof(char *), explain->columns, 0); row = mysql_fetch_row(res); for (j=0; j < explain->columns; j++) { explain->row[i].value[j] = my_estrdup(row[j]); Index: php-src/ext/mysqli/mysqli_api.c diff -u php-src/ext/mysqli/mysqli_api.c:1.38 php-src/ext/mysqli/mysqli_api.c:1.39 --- php-src/ext/mysqli/mysqli_api.c:1.38 Mon Jul 28 06:23:36 2003 +++ php-src/ext/mysqli/mysqli_api.c Mon Aug 11 20:55:56 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ - $Id: mysqli_api.c,v 1.38 2003/07/28 10:23:36 sniper Exp $ + $Id: mysqli_api.c,v 1.39 2003/08/12 00:55:56 iliaa Exp $ */ #ifdef HAVE_CONFIG_H @@ -127,7 +127,7 @@ php_free_stmt_bind_buffer(stmt->param, FETCH_SIMPLE); } - args = (zval ***)emalloc(argc * sizeof(zval **)); + args = (zval ***)safe_emalloc(argc, sizeof(zval **), 0); if (zend_get_parameters_array_ex(argc, args) == FAILURE) { efree(args); @@ -194,7 +194,7 @@ } stmt->param.var_cnt = num_vars; - stmt->param.vars = (zval **)emalloc(num_vars * sizeof(zval)); + stmt->param.vars = (zval **)safe_emalloc(num_vars, sizeof(zval), 0); for (i = 0; i < num_vars; i++) { if (bind[i].buffer_type != MYSQLI_BIND_SEND_DATA) { ZVAL_ADDREF(*args[i+start]); @@ -237,7 +237,7 @@ WRONG_PARAM_COUNT; } - args = (zval ***)emalloc(argc * sizeof(zval **)); + args = (zval ***)safe_emalloc(argc, sizeof(zval **), 0); if (zend_get_parameters_array_ex(argc, args) == FAILURE) { efree(args); @@ -338,7 +338,7 @@ } stmt->result.var_cnt = var_cnt; - stmt->result.vars = (zval **)emalloc((var_cnt) * sizeof(zval)); + stmt->result.vars = (zval **)safe_emalloc((var_cnt), sizeof(zval), 0); for (i = start; i < var_cnt+start; i++) { ofs = i-start; ZVAL_ADDREF(*args[i]); @@ -1464,7 +1464,7 @@ } MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, &mysql_link, "mysqli_link"); - newstr = emalloc(2 * escapestr_len + 1); + newstr = safe_emalloc(2, escapestr_len, 1); newstr_len = mysql_real_escape_string(mysql, newstr, escapestr, escapestr_len); newstr = erealloc(newstr, newstr_len + 1); Index: php-src/ext/mysql/php_mysql.c diff -u php-src/ext/mysql/php_mysql.c:1.197 php-src/ext/mysql/php_mysql.c:1.198 --- php-src/ext/mysql/php_mysql.c:1.197 Fri Aug 8 09:36:28 2003 +++ php-src/ext/mysql/php_mysql.c Mon Aug 11 20:55:56 2003 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_mysql.c,v 1.197 2003/08/08 13:36:28 iliaa Exp $ */ +/* $Id: php_mysql.c,v 1.198 2003/08/12 00:55:56 iliaa Exp $ */ /* TODO: * @@ -1668,7 +1668,7 @@ * be worth it */ - Z_STRVAL_P(return_value) = (char *) emalloc(Z_STRLEN_PP(str)*2+1); + Z_STRVAL_P(return_value) = (char *) safe_emalloc(Z_STRLEN_PP(str), 2, 1); Z_STRLEN_P(return_value) = mysql_escape_string(Z_STRVAL_P(return_value), Z_STRVAL_PP(str), Z_STRLEN_PP(str)); Z_TYPE_P(return_value) = IS_STRING; @@ -1701,7 +1701,7 @@ ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, &mysql_link, id, "MySQL-Link", le_link, le_plink); - new_str = emalloc(str_len * 2 + 1); + new_str = safe_emalloc(str_len, 2, 1); new_str_len = mysql_real_escape_string(&mysql->conn, new_str, str, str_len); new_str = erealloc(new_str, new_str_len + 1); Index: php-src/ext/odbc/php_odbc.c diff -u php-src/ext/odbc/php_odbc.c:1.169 php-src/ext/odbc/php_odbc.c:1.170 --- php-src/ext/odbc/php_odbc.c:1.169 Sun Aug 10 22:03:40 2003 +++ php-src/ext/odbc/php_odbc.c Mon Aug 11 20:55:56 2003 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_odbc.c,v 1.169 2003/08/11 02:03:40 sniper Exp $ */ +/* $Id: php_odbc.c,v 1.170 2003/08/12 00:55:56 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -634,7 +634,7 @@ SWORD colnamelen; /* Not used */ SDWORD displaysize; - result->values = (odbc_result_value *) emalloc(sizeof(odbc_result_value)*result->numcols); + result->values = (odbc_result_value *) safe_emalloc(sizeof(odbc_result_value), result->numcols, 0); result->longreadlen = ODBCG(defaultlrl); result->binmode = ODBCG(defaultbinmode); @@ -969,7 +969,7 @@ } zend_hash_internal_pointer_reset(Z_ARRVAL_PP(pv_param_arr)); - params = (params_t *)emalloc(sizeof(params_t) * result->numparams); + params = (params_t *)safe_emalloc(sizeof(params_t), result->numparams, 0); for(i = 1; i <= result->numparams; i++) { if (zend_hash_get_current_data(Z_ARRVAL_PP(pv_param_arr), (void **) &tmp) == FAILURE) { Index: php-src/ext/mssql/php_mssql.c diff -u php-src/ext/mssql/php_mssql.c:1.118 php-src/ext/mssql/php_mssql.c:1.119 --- php-src/ext/mssql/php_mssql.c:1.118 Sun Aug 3 13:44:36 2003 +++ php-src/ext/mssql/php_mssql.c Mon Aug 11 20:55:56 2003 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_mssql.c,v 1.118 2003/08/03 17:44:36 zeev Exp $ */ +/* $Id: php_mssql.c,v 1.119 2003/08/12 00:55:56 iliaa Exp $ */ #ifdef COMPILE_DL_MSSQL #define HAVE_MSSQL 1 @@ -989,7 +989,7 @@ int *column_types; char computed_buf[16]; - column_types = (int *) emalloc(sizeof(int) * result->num_fields); + column_types = (int *) safe_emalloc(sizeof(int), result->num_fields, 0); for (i=0; i<result->num_fields; i++) { char *fname = (char *)dbcolname(mssql_ptr->link,i+1); @@ -1036,14 +1036,14 @@ i=0; if (!result->data) { - result->data = (zval **) emalloc(sizeof(zval *)*MSSQL_ROWS_BLOCK*(++result->blocks_initialized)); + result->data = (zval **) safe_emalloc(sizeof(zval *), MSSQL_ROWS_BLOCK*(++result->blocks_initialized), 0); } while (retvalue!=FAIL && retvalue!=NO_MORE_ROWS) { result->num_rows++; if (result->num_rows > result->blocks_initialized*MSSQL_ROWS_BLOCK) { result->data = (zval **) erealloc(result->data,sizeof(zval *)*MSSQL_ROWS_BLOCK*(++result->blocks_initialized)); } - result->data[i] = (zval *) emalloc(sizeof(zval)*result->num_fields); + result->data[i] = (zval *) safe_emalloc(sizeof(zval), result->num_fields, 0); for (j=0; j<result->num_fields; j++) { INIT_ZVAL(result->data[i][j]); MS_SQL_G(get_column_content(mssql_ptr, j+1, &result->data[i][j], column_types[j] TSRMLS_CC)); @@ -1163,7 +1163,7 @@ result->cur_field=result->cur_row=result->num_rows=0; if (num_fields > 0) { - result->fields = (mssql_field *) emalloc(sizeof(mssql_field)*result->num_fields); + result->fields = (mssql_field *) safe_emalloc(sizeof(mssql_field), result->num_fields, 0); result->num_rows = _mssql_fetch_batch(mssql_ptr, result, retvalue TSRMLS_CC); } else @@ -1794,7 +1794,7 @@ retvalue = dbnextrow(mssql_ptr->link); result->num_fields = dbnumcols(mssql_ptr->link); - result->fields = (mssql_field *) emalloc(sizeof(mssql_field)*result->num_fields); + result->fields = (mssql_field *) safe_emalloc(sizeof(mssql_field), result->num_fields, 0); result->num_rows = _mssql_fetch_batch(mssql_ptr, result, retvalue TSRMLS_CC); RETURN_TRUE; } @@ -2101,12 +2101,12 @@ result = (mssql_result *) emalloc(sizeof(mssql_result)); result->batchsize = batchsize; result->blocks_initialized = 1; - result->data = (zval **) emalloc(sizeof(zval *)*MSSQL_ROWS_BLOCK); + result->data = (zval **) safe_emalloc(sizeof(zval *), MSSQL_ROWS_BLOCK); result->mssql_ptr = mssql_ptr; result->cur_field=result->cur_row=result->num_rows=0; result->num_fields = num_fields; - result->fields = (mssql_field *) emalloc(sizeof(mssql_field)*num_fields); + result->fields = (mssql_field *) safe_emalloc(sizeof(mssql_field), num_fields); result->num_rows = _mssql_fetch_batch(mssql_ptr, result, retvalue TSRMLS_CC); result->statement = statement; } Index: php-src/ext/msession/msession.c diff -u php-src/ext/msession/msession.c:1.43 php-src/ext/msession/msession.c:1.44 --- php-src/ext/msession/msession.c:1.43 Tue Jun 10 16:03:32 2003 +++ php-src/ext/msession/msession.c Mon Aug 11 20:55:57 2003 @@ -918,7 +918,7 @@ countpair = zend_hash_num_elements(htTuples); - pairs = (char **)emalloc(sizeof(char *) * countpair * 2); + pairs = (char **)safe_emalloc(sizeof(char *), countpair * 2, 0); ELOG("have pairs"); Index: php-src/ext/mono/php_mono.c diff -u php-src/ext/mono/php_mono.c:1.7 php-src/ext/mono/php_mono.c:1.8 --- php-src/ext/mono/php_mono.c:1.7 Thu Jun 5 12:52:29 2003 +++ php-src/ext/mono/php_mono.c Mon Aug 11 20:55:57 2003 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_mono.c,v 1.7 2003/06/05 16:52:29 sterling Exp $ */ +/* $Id: php_mono.c,v 1.8 2003/08/12 00:55:57 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -409,7 +409,7 @@ zval **tmp; int i; - p = emalloc(sizeof(php_parameters_typespec) * param_count); + p = safe_emalloc(sizeof(php_parameters_typespec), param_count, 0); for (i = 0; i < param_count; ++i) { tmp = (zval **) params[i]; p[i] = (int) Z_TYPE_PP(tmp); @@ -679,7 +679,7 @@ php_mono_object *pm; int argc = ZEND_NUM_ARGS(); - argv = (zval ***) emalloc(sizeof(zval **) * argc); + argv = (zval ***) safe_emalloc(sizeof(zval **), argc, 0); if (zend_get_parameters_array_ex(argc, argv) == FAILURE) { php_error(E_WARNING, "COuldn't fetch arguments for %s into Mono __call handler", method); RETURN_NULL(); @@ -903,7 +903,7 @@ php_mono_method_intern *method_obj; int argc = ZEND_NUM_ARGS(); - argv = (zval ***) emalloc(sizeof(zval **) * argc); + argv = (zval ***) safe_emalloc(sizeof(zval **), argc, 0); if (zend_get_parameters_array_ex(argc, argv) == FAILURE) { php_error(E_WARNING, "COuldn't fetch arguments into array in Mono Call handler"); RETURN_NULL(); @@ -990,7 +990,7 @@ intern->mobject = mono_object_new(domain, intern->mclass); if (params && Z_ARRVAL_P(params) && (param_count = zend_hash_num_elements(Z_ARRVAL_P(params)))) { - new_params = emalloc(sizeof(void *) * param_count); + new_params = safe_emalloc(sizeof(void *), param_count, 0); for (i = 0, zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(params), &pos); zend_hash_get_current_data_ex(Z_ARRVAL_P(params), (void **) &element, &pos) == SUCCESS; zend_hash_move_forward_ex(Z_ARRVAL_P(params), &pos), ++i) { Index: php-src/ext/oci8/oci8.c diff -u php-src/ext/oci8/oci8.c:1.213 php-src/ext/oci8/oci8.c:1.214 --- php-src/ext/oci8/oci8.c:1.213 Sun Aug 3 13:44:37 2003 +++ php-src/ext/oci8/oci8.c Mon Aug 11 20:55:57 2003 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: oci8.c,v 1.213 2003/08/03 17:44:37 zeev Exp $ */ +/* $Id: oci8.c,v 1.214 2003/08/12 00:55:57 iliaa Exp $ */ /* TODO list: * @@ -644,7 +644,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "OCI8 Support", "enabled"); - php_info_print_table_row(2, "Revision", "$Revision: 1.213 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.214 $"); #ifndef PHP_WIN32 php_info_print_table_row(2, "Oracle Version", PHP_OCI8_VERSION ); php_info_print_table_row(2, "Compile-time ORACLE_HOME", PHP_OCI8_DIR ); @@ -4139,7 +4139,7 @@ } if (flags & OCI_FETCHSTATEMENT_BY_ROW) { - columns = emalloc(statement->ncolumns * sizeof(oci_out_column *)); + columns = safe_emalloc(statement->ncolumns, sizeof(oci_out_column *), 0); for (i = 0; i < statement->ncolumns; i++) { columns[ i ] = oci_get_col(statement, i + 1, 0); @@ -4177,8 +4177,8 @@ efree(columns); } else { /* default to BY_COLUMN */ - columns = emalloc(statement->ncolumns * sizeof(oci_out_column *)); - outarrs = emalloc(statement->ncolumns * sizeof(zval*)); + columns = safe_emalloc(statement->ncolumns, sizeof(oci_out_column *), 0); + outarrs = safe_emalloc(statement->ncolumns, sizeof(zval*), 0); if (flags & OCI_NUM) { for (i = 0; i < statement->ncolumns; i++) { Index: php-src/ext/interbase/interbase.c diff -u php-src/ext/interbase/interbase.c:1.127 php-src/ext/interbase/interbase.c:1.128 --- php-src/ext/interbase/interbase.c:1.127 Sun Aug 10 16:53:19 2003 +++ php-src/ext/interbase/interbase.c Mon Aug 11 20:55:57 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: interbase.c,v 1.127 2003/08/10 20:53:19 abies Exp $ */ +/* $Id: interbase.c,v 1.128 2003/08/12 00:55:57 iliaa Exp $ */ /* TODO: Arrays, roles? @@ -687,7 +687,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "Interbase Support", "enabled"); - php_info_print_table_row(2, "Revision", "$Revision: 1.127 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.128 $"); #ifdef COMPILE_DL_INTERBASE php_info_print_table_row(2, "Dynamic Module", "Yes"); #endif @@ -799,7 +799,7 @@ WRONG_PARAM_COUNT; } - args = (zval ***) emalloc(sizeof(zval **) * ZEND_NUM_ARGS()); + args = (zval ***) safe_emalloc(sizeof(zval **), ZEND_NUM_ARGS()); if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) { efree(args); RETURN_FALSE; @@ -1084,7 +1084,7 @@ if (ar_cnt) { /* have arrays ? */ *array_cntp = ar_cnt; - IB_ARRAY = emalloc(sizeof(ibase_array)*ar_cnt); + IB_ARRAY = safe_emalloc(sizeof(ibase_array), ar_cnt, 0); ar_cnt = 0; var = sqlda->sqlvar; for (i = 0; i < sqlda->sqld; i++, var++) { @@ -1471,10 +1471,10 @@ for (i = 0; i < sqlda->sqld; i++, var++) { switch (var->sqltype & ~1) { case SQL_TEXT: - var->sqldata = emalloc(sizeof(char) * (var->sqllen)); + var->sqldata = safe_emalloc(sizeof(char), (var->sqllen), 0); break; case SQL_VARYING: - var->sqldata = emalloc(sizeof(char) * (var->sqllen + sizeof(short))); + var->sqldata = safe_emalloc(sizeof(char), (var->sqllen + sizeof(short)), 0); break; case SQL_SHORT: var->sqldata = emalloc(sizeof(short)); @@ -1549,7 +1549,7 @@ _php_ibase_alloc_xsqlda(out_sqlda); if (ib_query->out_array) { - IB_RESULT->out_array = emalloc(sizeof(ibase_array) * ib_query->out_array_cnt); + IB_RESULT->out_array = safe_emalloc(sizeof(ibase_array), ib_query->out_array_cnt, 0); memcpy(IB_RESULT->out_array, ib_query->out_array, sizeof(ibase_array) * ib_query->out_array_cnt); } else { IB_RESULT->out_array = NULL; @@ -1564,7 +1564,7 @@ } in_sqlda = emalloc(XSQLDA_LENGTH(ib_query->in_sqlda->sqld)); memcpy(in_sqlda, ib_query->in_sqlda, XSQLDA_LENGTH(ib_query->in_sqlda->sqld)); - bind_buf = emalloc(sizeof(BIND_BUF) * ib_query->in_sqlda->sqld); + bind_buf = safe_emalloc(sizeof(BIND_BUF), ib_query->in_sqlda->sqld, 0); if (_php_ibase_bind(in_sqlda, args, bind_buf, ib_query TSRMLS_CC) == FAILURE) { IBDEBUG("Could not bind input XSQLDA"); goto _php_ibase_exec_error; @@ -1720,7 +1720,7 @@ } /* register the transaction in our own data structures */ - ib_trans = (ibase_trans *) emalloc(sizeof(ibase_trans) + (link_cnt-1)*sizeof(ibase_db_link *)); + ib_trans = (ibase_trans *) safe_emalloc((link_cnt-1), sizeof(ibase_db_link *), sizeof(ibase_trans)); ib_trans->handle = tr_handle; ib_trans->link_cnt = link_cnt; ib_trans->affected_rows = 0; @@ -2261,7 +2261,7 @@ data = ((IBASE_VCHAR *) data)->var_str; /* fallout */ case SQL_TEXT: - Z_STRVAL_P(val) = (char *) emalloc(sizeof(char) * (len + 1)); + Z_STRVAL_P(val) = (char *) safe_emalloc(sizeof(char), (len + 1), 0); memcpy(Z_STRVAL_P(val), data, len); Z_STRVAL_P(val)[len] = '\0'; if (PG(magic_quotes_runtime)) { @@ -2894,7 +2894,7 @@ WRONG_PARAM_COUNT; } - args = (zval ***) emalloc(sizeof(zval **) * ZEND_NUM_ARGS()); + args = (zval ***) safe_emalloc(sizeof(zval **), ZEND_NUM_ARGS(), 0); if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) { efree(args); RETURN_FALSE; Index: php-src/ext/ingres_ii/ii.c diff -u php-src/ext/ingres_ii/ii.c:1.38 php-src/ext/ingres_ii/ii.c:1.39 --- php-src/ext/ingres_ii/ii.c:1.38 Tue Jun 10 16:03:30 2003 +++ php-src/ext/ingres_ii/ii.c Mon Aug 11 20:55:57 2003 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: ii.c,v 1.38 2003/06/10 20:03:30 imajes Exp $ */ +/* $Id: ii.c,v 1.39 2003/08/12 00:55:57 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1167,7 +1167,7 @@ } /* allocate memory for j fields */ - columnData = (IIAPI_DATAVALUE *) emalloc(j * sizeof(IIAPI_DATAVALUE)); + columnData = (IIAPI_DATAVALUE *) safe_emalloc(j, sizeof(IIAPI_DATAVALUE), 0); for (k = 1; k <= j; k++) { columnData[k - 1].dv_value = (II_PTR) emalloc((ii_link->descriptor[i + k - 2]).ds_length); } Index: php-src/ext/imap/php_imap.c diff -u php-src/ext/imap/php_imap.c:1.173 php-src/ext/imap/php_imap.c:1.174 --- php-src/ext/imap/php_imap.c:1.173 Tue Jun 17 10:13:17 2003 +++ php-src/ext/imap/php_imap.c Mon Aug 11 20:55:57 2003 @@ -26,7 +26,7 @@ | PHP 4.0 updates: Zeev Suraski <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ */ -/* $Id: php_imap.c,v 1.173 2003/06/17 14:13:17 iliaa Exp $ */ +/* $Id: php_imap.c,v 1.174 2003/08/12 00:55:57 iliaa Exp $ */ #define IMAP41 @@ -1345,7 +1345,7 @@ } array_init(return_value); - delim = emalloc(2 * sizeof(char)); + delim = safe_emalloc(2, sizeof(char), 0); cur=IMAPG(imap_folder_objects); while (cur != NIL) { MAKE_STD_ZVAL(mboxob); @@ -1654,7 +1654,7 @@ convert_to_string_ex(ref); convert_to_string_ex(pat); - delim = emalloc(2 * sizeof(char)); + delim = safe_emalloc(2, sizeof(char), 0); /* set flag for new, improved array of objects list */ IMAPG(folderlist_style) = FLIST_OBJECT; @@ -3551,7 +3551,7 @@ string = Z_STRVAL_PP(str); end = Z_STRLEN_PP(str); - charset = (char *) emalloc((end + 1) * 2); + charset = (char *) safe_emalloc((end + 1), 2, 0); text = &charset[end + 1]; while (offset < end) { /* Reached end of the string? */ if ((charset_token = (long)php_memnstr(&string[offset], "=?", 2, string + end))) { /* Is there anything encoded in the string? */ Index: php-src/ext/gd/libgd/gd.c diff -u php-src/ext/gd/libgd/gd.c:1.64 php-src/ext/gd/libgd/gd.c:1.65 --- php-src/ext/gd/libgd/gd.c:1.64 Sun Aug 10 16:13:38 2003 +++ php-src/ext/gd/libgd/gd.c Mon Aug 11 20:55:57 2003 @@ -1873,7 +1873,7 @@ oc = gdImageGetPixel(im, x, y); if (oc==nc || x<0 || x>wx2 || y<0 || y>wy2) return; - stack = (struct seg *)emalloc(sizeof(struct seg) * ((int)(im->sy*im->sx)/4)+1); + stack = (struct seg *)safe_emalloc(sizeof(struct seg), ((int)(im->sy*im->sx)/4), 1); sp = stack; /* required! */ @@ -1938,7 +1938,7 @@ pts[i] = (int *) ecalloc(im->sx, sizeof(int)); } - stack = (struct seg *)emalloc(sizeof(struct seg) * ((int)(im->sy*im->sx)/4)+1); + stack = (struct seg *)safe_emalloc(sizeof(struct seg), ((int)(im->sy*im->sx)/4), 1); sp = stack; oc = gdImageGetPixel(im, x, y); Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.275 php-src/ext/gd/gd.c:1.276 --- php-src/ext/gd/gd.c:1.275 Thu Jun 19 11:47:46 2003 +++ php-src/ext/gd/gd.c Mon Aug 11 20:55:57 2003 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: gd.c,v 1.275 2003/06/19 15:47:46 iliaa Exp $ */ +/* $Id: gd.c,v 1.276 2003/08/12 00:55:57 iliaa Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -762,7 +762,7 @@ convert_to_array_ex(styles); /* copy the style values in the stylearr */ - stylearr = emalloc(sizeof(int) * zend_hash_num_elements(HASH_OF(*styles))); + stylearr = safe_emalloc(sizeof(int), zend_hash_num_elements(HASH_OF(*styles)), 0); zend_hash_internal_pointer_reset_ex(HASH_OF(*styles), &pos); @@ -2572,7 +2572,7 @@ RETURN_FALSE; } - points = (gdPointPtr) emalloc(npoints * sizeof(gdPoint)); + points = (gdPointPtr) safe_emalloc(npoints, sizeof(gdPoint), 0); for (i = 0; i < npoints; i++) { if (zend_hash_index_find(Z_ARRVAL_PP(POINTS), (i * 2), (void **) &var) == SUCCESS) { Index: php-src/ext/ftp/ftp.c diff -u php-src/ext/ftp/ftp.c:1.88 php-src/ext/ftp/ftp.c:1.89 --- php-src/ext/ftp/ftp.c:1.88 Fri Jun 27 12:41:40 2003 +++ php-src/ext/ftp/ftp.c Mon Aug 11 20:55:58 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: ftp.c,v 1.88 2003/06/27 16:41:40 sniper Exp $ */ +/* $Id: ftp.c,v 1.89 2003/08/12 00:55:58 iliaa Exp $ */ #include "php.h" @@ -1635,7 +1635,7 @@ rewind(tmpfp); - ret = emalloc((lines + 1) * sizeof(char**) + size * sizeof(char*)); + ret = safe_emalloc((lines + 1), sizeof(char**), size * sizeof(char*)); entry = ret; text = (char*) (ret + lines + 1); Index: php-src/ext/fbsql/php_fbsql.c diff -u php-src/ext/fbsql/php_fbsql.c:1.99 php-src/ext/fbsql/php_fbsql.c:1.100 --- php-src/ext/fbsql/php_fbsql.c:1.99 Thu Jul 3 12:48:18 2003 +++ php-src/ext/fbsql/php_fbsql.c Mon Aug 11 20:55:58 2003 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_fbsql.c,v 1.99 2003/07/03 16:48:18 fmk Exp $ */ +/* $Id: php_fbsql.c,v 1.100 2003/08/12 00:55:58 iliaa Exp $ */ /* TODO: * @@ -2349,7 +2349,7 @@ *length = l*2+3+1; if (value) { - char* r = emalloc(l*2+3+1); + char* r = safe_emalloc(l, 2, 4); r[0] = 'X'; r[1] = '\''; for (i = 0; i < nBits / 8; i++) @@ -2371,7 +2371,7 @@ *length = l*2+3+1; if (value) { - char* r = emalloc(l*2+3+1); + char* r = safe_emalloc(l, 2, 1); r[0] = 'B'; r[1] = '\''; for (i = 0; i < nBits; i++) Index: php-src/ext/dom/element.c diff -u php-src/ext/dom/element.c:1.10 php-src/ext/dom/element.c:1.11 --- php-src/ext/dom/element.c:1.10 Sun Jul 27 13:57:06 2003 +++ php-src/ext/dom/element.c Mon Aug 11 20:55:58 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: element.c,v 1.10 2003/07/27 17:57:06 rrichards Exp $ */ +/* $Id: element.c,v 1.11 2003/08/12 00:55:58 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -407,7 +407,7 @@ ctxp = xmlXPathNewContext(docp); ctxp->node = nodep; - str = (char*) emalloc((name_len+13) * sizeof(char)) ; + str = (char*) safe_emalloc((name_len+13), sizeof(char), 0) ; sprintf(str ,"descendant::%s",name); xpathobjp = xmlXPathEval(str, ctxp); Index: php-src/ext/dom/document.c diff -u php-src/ext/dom/document.c:1.18 php-src/ext/dom/document.c:1.19 --- php-src/ext/dom/document.c:1.18 Sun Aug 10 16:39:58 2003 +++ php-src/ext/dom/document.c Mon Aug 11 20:55:58 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: document.c,v 1.18 2003/08/10 20:39:58 helly Exp $ */ +/* $Id: document.c,v 1.19 2003/08/12 00:55:58 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -700,7 +700,7 @@ ctxp = xmlXPathNewContext(docp); ctxp->node = NULL; - str = (char*) emalloc((name_len+3) * sizeof(char)) ; + str = (char*) safe_emalloc((name_len+3), sizeof(char), 0) ; sprintf(str ,"//%s",name); xpathobjp = xmlXPathEval(str, ctxp); Index: php-src/ext/db/db.c diff -u php-src/ext/db/db.c:1.89 php-src/ext/db/db.c:1.90 --- php-src/ext/db/db.c:1.89 Sat Jun 14 13:14:42 2003 +++ php-src/ext/db/db.c Mon Aug 11 20:55:58 2003 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: db.c,v 1.89 2003/06/14 17:14:42 helly Exp $ */ +/* $Id: db.c,v 1.90 2003/08/12 00:55:58 iliaa Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -637,7 +637,7 @@ value_datum = DBM_FETCH(dbf, key_datum); if (value_datum.dptr) { - ret = (char *)emalloc(sizeof(char) * value_datum.dsize + 1); + ret = (char *)safe_emalloc(sizeof(char), value_datum.dsize, 1); strncpy(ret, value_datum.dptr, value_datum.dsize); ret[value_datum.dsize] = '\0'; @@ -806,7 +806,7 @@ if (!ret_datum.dptr) return NULL; - ret = (char *)emalloc((ret_datum.dsize + 1) * sizeof(char)); + ret = (char *)safe_emalloc((ret_datum.dsize + 1), sizeof(char), 0); strncpy(ret, ret_datum.dptr, ret_datum.dsize); ret[ret_datum.dsize] = '\0'; @@ -873,7 +873,7 @@ ret_datum = DBM_NEXTKEY(dbf, key_datum); if (ret_datum.dptr) { - ret = (char *)emalloc(sizeof(char) * ret_datum.dsize + 1); + ret = (char *)safe_emalloc(sizeof(char), ret_datum.dsize, 1); strncpy(ret, ret_datum.dptr, ret_datum.dsize); ret[ret_datum.dsize] = '\0'; #if GDBM @@ -935,7 +935,7 @@ char *buf; if (flatfile_findkey(dbf, key_datum)) { - buf = emalloc((buf_size+1) * sizeof(char)); + buf = safe_emalloc((buf_size+1), sizeof(char), 0); if (fgets(buf, 15, dbf)) { num = atoi(buf); if (num > buf_size) { @@ -963,7 +963,7 @@ rewind(dbf); - buf = emalloc((buf_size + 1)*sizeof(char)); + buf = safe_emalloc((buf_size + 1), sizeof(char), 0); while(!feof(dbf)) { /* read in the length of the key name */ if (!fgets(buf, 15, dbf)) @@ -996,7 +996,7 @@ if (num > buf_size) { buf_size+=num; if (buf) efree(buf); - buf = emalloc((buf_size+1)*sizeof(char)); + buf = safe_emalloc((buf_size+1), sizeof(char), 0); } /* read in the value */ num = fread(buf, sizeof(char), num, dbf); @@ -1019,14 +1019,14 @@ int size = key_datum.dsize; rewind(dbf); - buf = emalloc((buf_size+1)*sizeof(char)); + buf = safe_emalloc((buf_size+1), sizeof(char), 0); while (!feof(dbf)) { if (!fgets(buf, 15, dbf)) break; num = atoi(buf); if (num > buf_size) { if (buf) efree(buf); buf_size+=num; - buf = emalloc((buf_size+1)*sizeof(char)); + buf = safe_emalloc((buf_size+1), sizeof(char), 0); } num = fread(buf, sizeof(char), num, dbf); if (num<0) break; @@ -1043,7 +1043,7 @@ if (num > buf_size) { if (buf) efree(buf); buf_size+=num; - buf = emalloc((buf_size+1)*sizeof(char)); + buf = safe_emalloc((buf_size+1), sizeof(char), 0); } num = fread(buf, sizeof(char), num, dbf); if (num<0) break; @@ -1062,14 +1062,14 @@ int buf_size=1024; rewind(dbf); - buf.dptr = emalloc((buf_size+1)*sizeof(char)); + buf.dptr = safe_emalloc((buf_size+1), sizeof(char), 0); while(!feof(dbf)) { if (!fgets(buf.dptr, 15, dbf)) break; num = atoi(buf.dptr); if (num > buf_size) { buf_size+=num; if (buf.dptr) efree(buf.dptr); - buf.dptr = emalloc((buf_size+1)*sizeof(char)); + buf.dptr = safe_emalloc((buf_size+1), sizeof(char), 0); } num = fread(buf.dptr, sizeof(char), num, dbf); if (num<0) break; @@ -1083,7 +1083,7 @@ if (num > buf_size) { buf_size+=num; if (buf.dptr) efree(buf.dptr); - buf.dptr = emalloc((buf_size+1)*sizeof(char)); + buf.dptr = safe_emalloc((buf_size+1), sizeof(char), 0); } num = fread(buf.dptr, sizeof(char), num, dbf); if (num<0) break; @@ -1102,14 +1102,14 @@ int buf_size=1024; fseek(dbf, CurrentFlatFilePos, SEEK_SET); - buf.dptr = emalloc((buf_size+1)*sizeof(char)); + buf.dptr = safe_emalloc((buf_size+1), sizeof(char), 0); while(!feof(dbf)) { if (!fgets(buf.dptr, 15, dbf)) break; num = atoi(buf.dptr); if (num > buf_size) { buf_size+=num; if (buf.dptr) efree(buf.dptr); - buf.dptr = emalloc((buf_size+1)*sizeof(char)); + buf.dptr = safe_emalloc((buf_size+1), sizeof(char), 0); } num = fread(buf.dptr, sizeof(char), num, dbf); if (num<0) break; @@ -1118,7 +1118,7 @@ if (num > buf_size) { buf_size+=num; if (buf.dptr) efree(buf.dptr); - buf.dptr = emalloc((buf_size+1)*sizeof(char)); + buf.dptr = safe_emalloc((buf_size+1), sizeof(char), 0); } num = fread(buf.dptr, sizeof(char), num, dbf); if (num<0) break;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php