From f4a30e483c6f1d73f5bc4165aa70ecae9eff2c37 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Thu, 1 May 2003 21:08:47 +0000 Subject: [PATCH] MFH --- ext/mbstring/mbstring.c | 8 ++++---- ext/mbstring/php_mbregex.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 3c0ba33b2b..445f1c7c51 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -894,7 +894,7 @@ PHP_RINIT_FUNCTION(mbstring) list = (int*)php_mbstr_default_identify_list; n = php_mbstr_default_identify_list_size; } - entry = (int *)emalloc(n*sizeof(int)); + entry = (int *)safe_emalloc(n, sizeof(int), 0); if (entry != NULL) { MBSTRG(current_detect_order_list) = entry; MBSTRG(current_detect_order_list_size) = n; @@ -3038,7 +3038,7 @@ PHP_FUNCTION(mb_convert_variables) /* auto detect */ from_encoding = mbfl_no_encoding_invalid; stack_max = PHP_MBSTR_STACK_BLOCK_SIZE; - stack = (pval ***)emalloc(stack_max*sizeof(pval **)); + stack = (pval ***)safe_emalloc(stack_max, sizeof(pval **), 0); if (stack != NULL) { stack_level = 0; identd = mbfl_encoding_detector_new(elist, elistsz TSRMLS_CC); @@ -3126,7 +3126,7 @@ detect_end: /* convert */ if (convd != NULL) { stack_max = PHP_MBSTR_STACK_BLOCK_SIZE; - stack = (pval ***)emalloc(stack_max*sizeof(pval **)); + stack = (pval ***)safe_emalloc(stack_max, sizeof(pval **), 0); if (stack != NULL) { stack_level = 0; n = 2; @@ -3249,7 +3249,7 @@ php_mbstr_numericentity_exec(INTERNAL_FUNCTION_PARAMETERS, int type) zend_hash_internal_pointer_reset(target_hash); i = zend_hash_num_elements(target_hash); if (i > 0) { - convmap = (int *)emalloc(i*sizeof(int)); + convmap = (int *)safe_emalloc(i, sizeof(int), 0); if (convmap != NULL) { mapelm = convmap; mapsize = 0; diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index 450fadf6f7..63f84c52b2 100644 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@ -145,7 +145,7 @@ php_mbregex_compile_pattern(mb_regex_t *pre, const char *pattern, int patlen, in if(zend_hash_find(&MBSTRG(ht_rc), (char *)pattern, patlen+1, (void **) &rc) == FAILURE || rc->options != options || rc->mbctype != mbctype) { memset(pre, 0, sizeof(*pre)); - pre->fastmap = (char*)emalloc((1 << MBRE_BYTEWIDTH)*sizeof(char)); + pre->fastmap = (char*)safe_emalloc((1 << MBRE_BYTEWIDTH), sizeof(char), 0); if (pre->fastmap) { pre->options = options; pre->mbctype = mbctype; -- 2.40.0