iliaa           Mon Aug 11 19:16:54 2003 EDT

  Modified files:              
    /php-src/ext/standard       array.c exec.c file.c filestat.c 
                                formatted_print.c levenshtein.c metaphone.c 
                                pack.c reg.c scanf.c string.c url.c var.c 
                                versioning.c 
  Log:
  emalloc -> safe_emalloc
  
  
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.241 php-src/ext/standard/array.c:1.242
--- php-src/ext/standard/array.c:1.241  Sat Aug  9 16:48:59 2003
+++ php-src/ext/standard/array.c        Mon Aug 11 19:16:53 2003
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: array.c,v 1.241 2003/08/09 20:48:59 iliaa Exp $ */
+/* $Id: array.c,v 1.242 2003/08/11 23:16:53 iliaa Exp $ */
 
 #include "php.h"
 #include "php_ini.h"
@@ -880,7 +880,7 @@
                        RETURN_FALSE;
                }
        } else {
-               pval ***args = (pval ***) emalloc(sizeof(pval **)*ZEND_NUM_ARGS());
+               pval ***args = (pval ***) safe_emalloc(sizeof(pval **), 
ZEND_NUM_ARGS(), 0);
                pval **min, result;
                int i;
 
@@ -932,7 +932,7 @@
                        RETURN_FALSE;
                }
        } else {
-               pval ***args = (pval ***) emalloc(sizeof(pval **)*ZEND_NUM_ARGS());
+               pval ***args = (pval ***) safe_emalloc(sizeof(pval **), 
ZEND_NUM_ARGS(), 0);
                pval **max, result;
                int i;
 
@@ -1419,7 +1419,7 @@
        zval ***args;                   /* function arguments array */
        int i;
        
-       args = (zval ***)emalloc(ZEND_NUM_ARGS() * sizeof(zval **));
+       args = (zval ***)safe_emalloc(ZEND_NUM_ARGS(), sizeof(zval **), 0);
        
        if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
                efree(args);
@@ -1643,7 +1643,7 @@
                return;
        }
 
-       elems = (Bucket **)emalloc(n_elems * sizeof(Bucket *));
+       elems = (Bucket **)safe_emalloc(n_elems, sizeof(Bucket *), 0);
        hash = Z_ARRVAL_P(array);
        n_left = n_elems;
 
@@ -1818,7 +1818,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;
@@ -1947,7 +1947,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;
@@ -1997,7 +1997,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;
@@ -2026,7 +2026,7 @@
                
                /* Create the array of replacement elements */
                repl_num = zend_hash_num_elements(Z_ARRVAL_PP(args[3]));
-               repl = (zval ***)emalloc(repl_num * sizeof(zval **));
+               repl = (zval ***)safe_emalloc(repl_num, sizeof(zval **), 0);
                for (p=Z_ARRVAL_PP(args[3])->pListHead, i=0; p; p=p->pListNext, i++) {
                        repl[i] = ((zval **)p->pData);
                }
@@ -2204,7 +2204,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;
@@ -2503,7 +2503,7 @@
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "You may only pad up to 
1048576 elements at a time");
                RETURN_FALSE;
        }
-       pads = (zval ***)emalloc(num_pads * sizeof(zval **));
+       pads = (zval ***)safe_emalloc(num_pads, sizeof(zval **), 0);
        for (i = 0; i < num_pads; i++) {
                pads[i] = pad_value;
        }
@@ -2711,14 +2711,14 @@
                WRONG_PARAM_COUNT;
        }
        /* 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;
        }
        /* for each argument, create and sort list with pointers to the hash buckets */
-       lists = (Bucket ***)emalloc(argc * sizeof(Bucket **));
-       ptrs = (Bucket ***)emalloc(argc * sizeof(Bucket **));
+       lists = (Bucket ***)safe_emalloc(argc, sizeof(Bucket **), 0);
+       ptrs = (Bucket ***)safe_emalloc(argc, sizeof(Bucket **), 0);
        set_compare_func(SORT_STRING TSRMLS_CC);
        for (i=0; i<argc; i++) {
                if (Z_TYPE_PP(args[i]) != IS_ARRAY) {
@@ -2868,14 +2868,14 @@
                WRONG_PARAM_COUNT;
        }
        /* 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;
        }
        /* for each argument, create and sort list with pointers to the hash buckets */
-       lists = (Bucket ***)emalloc(argc * sizeof(Bucket **));
-       ptrs = (Bucket ***)emalloc(argc * sizeof(Bucket **));
+       lists = (Bucket ***)safe_emalloc(argc, sizeof(Bucket **), 0);
+       ptrs = (Bucket ***)safe_emalloc(argc, sizeof(Bucket **), 0);
        set_compare_func(SORT_STRING TSRMLS_CC);
        for (i = 0; i < argc; i++) {
                if (Z_TYPE_PP(args[i]) != IS_ARRAY) {
@@ -3061,7 +3061,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;
@@ -3163,9 +3163,9 @@
         * of the input arrays + 1. The last column is NULL to indicate the end
         * of the row.
         */
-       indirect = (Bucket ***)emalloc(array_size * sizeof(Bucket **));
+       indirect = (Bucket ***)safe_emalloc(array_size, sizeof(Bucket **), 0);
        for (i = 0; i < array_size; i++)
-               indirect[i] = (Bucket **)emalloc((num_arrays+1) * sizeof(Bucket *));
+               indirect[i] = (Bucket **)safe_emalloc((num_arrays+1), sizeof(Bucket 
*), 0);
        
        for (i = 0; i < num_arrays; i++) {
                k = 0;
Index: php-src/ext/standard/exec.c
diff -u php-src/ext/standard/exec.c:1.102 php-src/ext/standard/exec.c:1.103
--- php-src/ext/standard/exec.c:1.102   Thu Aug  7 11:51:05 2003
+++ php-src/ext/standard/exec.c Mon Aug 11 19:16:53 2003
@@ -16,7 +16,7 @@
    |         Ilia Alshanetsky <[EMAIL PROTECTED]>                             |
    +----------------------------------------------------------------------+
  */
-/* $Id: exec.c,v 1.102 2003/08/07 15:51:05 zeev Exp $ */
+/* $Id: exec.c,v 1.103 2003/08/11 23:16:53 iliaa Exp $ */
 
 #include <stdio.h>
 #include "php.h"
@@ -263,7 +263,7 @@
        char *p = NULL;
 
        l = strlen(str);
-       cmd = emalloc(2 * l + 1);
+       cmd = safe_emalloc(2, l, 1);
        
        for (x = 0, y = 0; x < l; x++) {
                switch (str[x]) {
@@ -320,7 +320,7 @@
        y = 0;
        l = strlen(str);
        
-       cmd = emalloc(4 * l + 3); /* worst case */
+       cmd = safe_emalloc(4, l, 3); /* worst case */
        
        cmd[y++] = '\'';
        
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.354 php-src/ext/standard/file.c:1.355
--- php-src/ext/standard/file.c:1.354   Tue Jul 29 14:26:34 2003
+++ php-src/ext/standard/file.c Mon Aug 11 19:16:53 2003
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: file.c,v 1.354 2003/07/29 18:26:34 iliaa Exp $ */
+/* $Id: file.c,v 1.355 2003/08/11 23:16:53 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -953,7 +953,7 @@
 
        php_stream_from_zval(stream, arg1);
 
-       buf = emalloc(2 * sizeof(char));
+       buf = safe_emalloc(2, sizeof(char), 0);
 
        result = php_stream_getc(stream);
 
@@ -1019,7 +1019,7 @@
                }
 
                len = (size_t) Z_LVAL_PP(bytes);
-               buf = emalloc(sizeof(char) * (len + 1));
+               buf = safe_emalloc(sizeof(char), (len + 1), 0);
                /*needed because recv doesnt set null char at end*/
                memset(buf, 0, len + 1);
        }
@@ -1055,7 +1055,7 @@
        if (argCount < 2) {
                WRONG_PARAM_COUNT;
        }
-       args = (zval ***)emalloc(argCount * sizeof(zval **));
+       args = (zval ***)safe_emalloc(argCount, sizeof(zval **), 0);
        if (zend_get_parameters_array_ex(argCount, args) == FAILURE) {
                efree( args );
                WRONG_PARAM_COUNT;
Index: php-src/ext/standard/filestat.c
diff -u php-src/ext/standard/filestat.c:1.123 php-src/ext/standard/filestat.c:1.124
--- php-src/ext/standard/filestat.c:1.123       Tue Jun 24 09:56:25 2003
+++ php-src/ext/standard/filestat.c     Mon Aug 11 19:16:53 2003
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: filestat.c,v 1.123 2003/06/24 13:56:25 iliaa Exp $ */
+/* $Id: filestat.c,v 1.124 2003/08/11 23:16:53 iliaa Exp $ */
 
 #include "php.h"
 #include "safe_mode.h"
@@ -644,7 +644,7 @@
 
                        groups = getgroups(0, NULL);
                        if(groups) {
-                               gids=(gid_t *)emalloc(groups*sizeof(gid_t));
+                               gids=(gid_t *)safe_emalloc(groups, sizeof(gid_t), 0);
                                n=getgroups(groups, gids);
                                for(i=0;i<n;i++){
                                        if(BG(sb).st_gid==gids[i]) {
Index: php-src/ext/standard/formatted_print.c
diff -u php-src/ext/standard/formatted_print.c:1.68 
php-src/ext/standard/formatted_print.c:1.69
--- php-src/ext/standard/formatted_print.c:1.68 Tue Jun 10 16:03:37 2003
+++ php-src/ext/standard/formatted_print.c      Mon Aug 11 19:16:53 2003
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: formatted_print.c,v 1.68 2003/06/10 20:03:37 imajes Exp $ */
+/* $Id: formatted_print.c,v 1.69 2003/08/11 23:16:53 iliaa Exp $ */
 
 #include <math.h>                              /* modf() */
 #include "php.h"
@@ -471,7 +471,7 @@
                        || (!use_array && argc < (1 + format_offset))) {
                WRONG_PARAM_COUNT_WITH_RETVAL(NULL);
        }
-       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);
@@ -490,7 +490,7 @@
                convert_to_array_ex(array);
                
                argc = 1 + zend_hash_num_elements(Z_ARRVAL_PP(array));
-               newargs = (zval ***)emalloc(argc * sizeof(zval *));
+               newargs = (zval ***)safe_emalloc(argc, sizeof(zval *), 0);
                newargs[0] = z_format;
                
                for (zend_hash_internal_pointer_reset(Z_ARRVAL_PP(array));
Index: php-src/ext/standard/levenshtein.c
diff -u php-src/ext/standard/levenshtein.c:1.30 php-src/ext/standard/levenshtein.c:1.31
--- php-src/ext/standard/levenshtein.c:1.30     Tue Jun 10 16:03:38 2003
+++ php-src/ext/standard/levenshtein.c  Mon Aug 11 19:16:53 2003
@@ -15,7 +15,7 @@
    | Author: Hartmut Holzgraefe <[EMAIL PROTECTED]>                        |
    +----------------------------------------------------------------------+
  */
-/* $Id: levenshtein.c,v 1.30 2003/06/10 20:03:38 imajes Exp $ */
+/* $Id: levenshtein.c,v 1.31 2003/08/11 23:16:53 iliaa Exp $ */
 
 #include "php.h"
 #include <stdlib.h>
@@ -40,10 +40,10 @@
        if((l1>LEVENSHTEIN_MAX_LENTH)||(l2>LEVENSHTEIN_MAX_LENTH))
                return -1;
 
-       if(!(p1=emalloc((l2+1)*sizeof(int)))) {
+       if(!(p1=safe_emalloc((l2+1), sizeof(int), 0))) {
                return -2;
        }
-       if(!(p2=emalloc((l2+1)*sizeof(int)))) {
+       if(!(p2=safe_emalloc((l2+1), sizeof(int), 0))) {
                free(p1);
                return -2;
        }
Index: php-src/ext/standard/metaphone.c
diff -u php-src/ext/standard/metaphone.c:1.25 php-src/ext/standard/metaphone.c:1.26
--- php-src/ext/standard/metaphone.c:1.25       Tue Jun 10 16:03:38 2003
+++ php-src/ext/standard/metaphone.c    Mon Aug 11 19:16:53 2003
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: metaphone.c,v 1.25 2003/06/10 20:03:38 imajes Exp $ */
+/* $Id: metaphone.c,v 1.26 2003/08/11 23:16:53 iliaa Exp $ */
 
 /*
        Based on CPANs "Text-Metaphone-1.96" by Michael G Schwern <[EMAIL PROTECTED]> 
@@ -183,10 +183,10 @@
 /*-- Allocate memory for our phoned_phrase --*/
        if (max_phonemes == 0) {        /* Assume largest possible */
                max_buffer_len = word_len;
-               *phoned_word = emalloc(sizeof(char) * word_len + 1);
+               *phoned_word = safe_emalloc(sizeof(char), word_len, 1);
        } else {
                max_buffer_len = max_phonemes;
-               *phoned_word = emalloc(sizeof(char) * max_phonemes + 1);
+               *phoned_word = safe_emalloc(sizeof(char), max_phonemes, 1);
        }
 
 
Index: php-src/ext/standard/pack.c
diff -u php-src/ext/standard/pack.c:1.48 php-src/ext/standard/pack.c:1.49
--- php-src/ext/standard/pack.c:1.48    Tue Jun 10 16:03:38 2003
+++ php-src/ext/standard/pack.c Mon Aug 11 19:16:53 2003
@@ -15,7 +15,7 @@
    | Author: Chris Schneider <[EMAIL PROTECTED]>                          |
    +----------------------------------------------------------------------+
  */
-/* $Id: pack.c,v 1.48 2003/06/10 20:03:38 imajes Exp $ */
+/* $Id: pack.c,v 1.49 2003/08/11 23:16:53 iliaa Exp $ */
 
 #include "php.h"
 
@@ -120,7 +120,7 @@
                WRONG_PARAM_COUNT;
        }
 
-       argv = emalloc(argc * sizeof(zval **));
+       argv = safe_emalloc(argc, sizeof(zval **), 0);
 
        if (zend_get_parameters_array_ex(argc, argv) == FAILURE) {
                efree(argv);
@@ -132,8 +132,8 @@
        formatlen = Z_STRLEN_PP(argv[0]);
 
        /* We have a maximum of <formatlen> format codes to deal with */
-       formatcodes = emalloc(formatlen * sizeof(*formatcodes));
-       formatargs = emalloc(formatlen * sizeof(*formatargs));
+       formatcodes = safe_emalloc(formatlen, sizeof(*formatcodes), 0);
+       formatargs = safe_emalloc(formatlen, sizeof(*formatargs), 0);
        currentarg = 1;
 
        /* Preprocess format into formatcodes and formatargs */
Index: php-src/ext/standard/reg.c
diff -u php-src/ext/standard/reg.c:1.76 php-src/ext/standard/reg.c:1.77
--- php-src/ext/standard/reg.c:1.76     Tue Jun 10 16:03:38 2003
+++ php-src/ext/standard/reg.c  Mon Aug 11 19:16:53 2003
@@ -17,7 +17,7 @@
    |          Jaakko Hyv�tti <[EMAIL PROTECTED]>                      | 
    +----------------------------------------------------------------------+
  */
-/* $Id: reg.c,v 1.76 2003/06/10 20:03:38 imajes Exp $ */
+/* $Id: reg.c,v 1.77 2003/08/11 23:16:53 iliaa Exp $ */
 
 #include <stdio.h>
 #include <ctype.h>
@@ -118,7 +118,7 @@
        /* get the length of the message */
        buf_len = regerror(REG_ITOA | err, re, NULL, 0);
        if (buf_len) {
-               buf = (char *)emalloc(buf_len * sizeof(char));
+               buf = (char *)safe_emalloc(buf_len, sizeof(char), 0);
                if (!buf) return; /* fail silently */
                /* finally, get the error message */
                regerror(REG_ITOA | err, re, buf, buf_len);
@@ -130,7 +130,7 @@
        if (len) {
                TSRMLS_FETCH();
 
-               message = (char *)emalloc((buf_len + len + 2) * sizeof(char));
+               message = (char *)safe_emalloc((buf_len + len + 2), sizeof(char), 0);
                if (!message) {
                        return; /* fail silently */
                }
@@ -298,7 +298,7 @@
        /* start with a buffer that is twice the size of the stringo
           we're doing replacements in */
        buf_len = 2 * string_len + 1;
-       buf = emalloc(buf_len * sizeof(char));
+       buf = safe_emalloc(buf_len, sizeof(char), 0);
 
        err = pos = 0;
        buf[0] = '\0';
@@ -373,7 +373,7 @@
                                new_l = strlen (buf) + 1;
                                if (new_l + 1 > buf_len) {
                                        buf_len = 1 + buf_len + 2 * new_l;
-                                       nbuf = emalloc(buf_len * sizeof(char));
+                                       nbuf = safe_emalloc(buf_len, sizeof(char), 0);
                                        strcpy(nbuf, buf);
                                        efree(buf);
                                        buf = nbuf;
@@ -388,7 +388,7 @@
                        new_l = strlen(buf) + strlen(&string[pos]);
                        if (new_l + 1 > buf_len) {
                                buf_len = new_l + 1; /* now we know exactly how long 
it is */
-                               nbuf = emalloc(buf_len * sizeof(char));
+                               nbuf = safe_emalloc(buf_len, sizeof(char), 0);
                                strcpy(nbuf, buf);
                                efree(buf);
                                buf = nbuf;
@@ -607,7 +607,7 @@
        }       
        convert_to_string_ex(string);
        
-       tmp = emalloc((Z_STRLEN_PP(string) * 4) + 1);
+       tmp = safe_emalloc(Z_STRLEN_PP(string), 4, 1);
        
        for (i = j = 0; i < Z_STRLEN_PP(string); i++) {
                c = (unsigned char) Z_STRVAL_PP(string)[i];
Index: php-src/ext/standard/scanf.c
diff -u php-src/ext/standard/scanf.c:1.24 php-src/ext/standard/scanf.c:1.25
--- php-src/ext/standard/scanf.c:1.24   Tue Jun 10 16:03:38 2003
+++ php-src/ext/standard/scanf.c        Mon Aug 11 19:16:53 2003
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: scanf.c,v 1.24 2003/06/10 20:03:38 imajes Exp $ */
+/* $Id: scanf.c,v 1.25 2003/08/11 23:16:53 iliaa Exp $ */
 
 /*
    scanf.c --
@@ -175,9 +175,9 @@
                ch = end++;
        }
 
-       cset->chars = (char *) emalloc(sizeof(char) * (end - format - 1));
+       cset->chars = (char *) safe_emalloc(sizeof(char), (end - format - 1), 0);
        if (nranges > 0) {
-               cset->ranges = (struct Range *) emalloc(sizeof(struct Range)*nranges);
+               cset->ranges = (struct Range *) safe_emalloc(sizeof(struct Range), 
nranges, 0);
        } else {
                cset->ranges = NULL;
        }
@@ -337,7 +337,7 @@
         */
 
        if (numVars > nspace) {
-               nassign = (int*)emalloc(sizeof(int) * numVars);
+               nassign = (int*)safe_emalloc(sizeof(int), numVars, 0);
                nspace = numVars;
        }
        for (i = 0; i < nspace; i++) {
@@ -513,7 +513,7 @@
                                        nspace += STATIC_LIST_SIZE;
                                }
                                if (nassign == staticAssign) {
-                                       nassign = (void *)emalloc(nspace * 
sizeof(int));
+                                       nassign = (void *)safe_emalloc(nspace, 
sizeof(int), 0);
                                        for (i = 0; i < STATIC_LIST_SIZE; ++i) {
                                                nassign[i] = staticAssign[i];
                                        }
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.394 php-src/ext/standard/string.c:1.395
--- php-src/ext/standard/string.c:1.394 Thu Jul 24 21:03:39 2003
+++ php-src/ext/standard/string.c       Mon Aug 11 19:16:53 2003
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: string.c,v 1.394 2003/07/25 01:03:39 pollita Exp $ */
+/* $Id: string.c,v 1.395 2003/08/11 23:16:53 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -118,7 +118,7 @@
        register unsigned char *result = NULL;
        size_t i, j;
 
-       result = (char *) emalloc(oldlen * 2 * sizeof(char) + 1);
+       result = (char *) safe_emalloc(oldlen * 2, sizeof(char), 1);
        
        for (i = j = 0; i < oldlen; i++) {
                result[j++] = hexconvtab[old[i] >> 4];
@@ -1707,7 +1707,7 @@
        chunks = srclen / chunklen;
        restlen = srclen - chunks * chunklen; /* srclen % chunklen */
 
-       dest = emalloc((srclen + (chunks + 1) * endlen + 1) * sizeof(char));
+       dest = safe_emalloc((srclen + (chunks + 1) * endlen + 1), sizeof(char), 0);
 
        for (p = src, q = dest; p < (src + srclen - chunklen + 1); ) {
                memcpy(q, p, chunklen);
@@ -2100,7 +2100,7 @@
                RETURN_FALSE;
        }
        
-       str = emalloc(2 * Z_STRLEN_PP(arg) + 1);
+       str = safe_emalloc(2, Z_STRLEN_PP(arg), 1);
        
        for (p = old, q = str; p != old_end; p++) {
                c = *p;
@@ -2727,7 +2727,7 @@
 PHPAPI char *php_addcslashes(char *str, int length, int *new_length, int should_free, 
char *what, int wlength TSRMLS_DC)
 {
        char flags[256];
-       char *new_str = emalloc((length?length:(length=strlen(str)))*4+1); 
+       char *new_str = safe_emalloc(4, (length?length:(length=strlen(str))), 1);
        char *source, *target;
        char *end;
        char c;
@@ -2795,7 +2795,7 @@
                *new_length = 0;
                return str;
        }
-       new_str = (char *) emalloc((length ? length : (length = strlen(str))) * 2 + 1);
+       new_str = (char *) safe_emalloc(2, (length ? length : (length = strlen(str))), 
1);
        source = str;
        end = source + length;
        target = new_str;
@@ -2948,7 +2948,7 @@
                        if (str_len < needle_len) {
                                new_str = emalloc(length + 1);
                        } else {
-                               new_str = emalloc((length / needle_len + 1) * str_len);
+                               new_str = safe_emalloc((length / needle_len + 1), 
str_len, 0);
                        }
 
                        e = s = new_str;
@@ -3553,7 +3553,7 @@
    Set locale information */
 PHP_FUNCTION(setlocale)
 {
-       pval ***args = (pval ***) emalloc(sizeof(pval **)*ZEND_NUM_ARGS());
+       pval ***args = (pval ***) safe_emalloc(sizeof(pval **), ZEND_NUM_ARGS(), 0);
        zval **pcategory, **plocale;
        int i, cat, n_args=ZEND_NUM_ARGS();
        char *loc, *retval;
@@ -4409,7 +4409,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);
                WRONG_PARAM_COUNT;
Index: php-src/ext/standard/url.c
diff -u php-src/ext/standard/url.c:1.67 php-src/ext/standard/url.c:1.68
--- php-src/ext/standard/url.c:1.67     Mon Jul 21 09:36:23 2003
+++ php-src/ext/standard/url.c  Mon Aug 11 19:16:53 2003
@@ -15,7 +15,7 @@
    | Author: Jim Winstead <[EMAIL PROTECTED]>                                  |
    +----------------------------------------------------------------------+
  */
-/* $Id: url.c,v 1.67 2003/07/21 13:36:23 iliaa Exp $ */
+/* $Id: url.c,v 1.68 2003/08/11 23:16:53 iliaa Exp $ */
 
 #include <stdlib.h>
 #include <string.h>
@@ -369,7 +369,7 @@
        
        from = s;
        end = s + len;
-       start = to = (unsigned char *) emalloc(3 * len + 1);
+       start = to = (unsigned char *) safe_emalloc(3, len, 1);
 
        while (from < end) {
                c = *from++;
@@ -476,7 +476,7 @@
        register int x, y;
        unsigned char *str;
 
-       str = (unsigned char *) emalloc(3 * len + 1);
+       str = (unsigned char *) safe_emalloc(3, len, 1);
        for (x = 0, y = 0; len--; x++, y++) {
                str[y] = (unsigned char) s[x];
 #ifndef CHARSET_EBCDIC
Index: php-src/ext/standard/var.c
diff -u php-src/ext/standard/var.c:1.169 php-src/ext/standard/var.c:1.170
--- php-src/ext/standard/var.c:1.169    Sun Aug 10 23:22:24 2003
+++ php-src/ext/standard/var.c  Mon Aug 11 19:16:53 2003
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: var.c,v 1.169 2003/08/11 03:22:24 iliaa Exp $ */
+/* $Id: var.c,v 1.170 2003/08/11 23:16:53 iliaa Exp $ */
 
 
 /* {{{ includes 
@@ -141,7 +141,7 @@
        
        argc = ZEND_NUM_ARGS();
        
-       args = (zval ***)emalloc(argc * sizeof(zval **));
+       args = (zval ***)safe_emalloc(argc, sizeof(zval **), 0);
        if (ZEND_NUM_ARGS() == 0 || zend_get_parameters_array_ex(argc, args) == 
FAILURE) {
                efree(args);
                WRONG_PARAM_COUNT;
@@ -245,7 +245,7 @@
        
        argc = ZEND_NUM_ARGS();
        
-       args = (zval ***)emalloc(argc * sizeof(zval **));
+       args = (zval ***)safe_emalloc(argc, sizeof(zval **), 0);
        if (ZEND_NUM_ARGS() == 0 || zend_get_parameters_array_ex(argc, args) == 
FAILURE) {
                efree(args);
                WRONG_PARAM_COUNT;
Index: php-src/ext/standard/versioning.c
diff -u php-src/ext/standard/versioning.c:1.16 php-src/ext/standard/versioning.c:1.17
--- php-src/ext/standard/versioning.c:1.16      Tue Aug  5 08:34:31 2003
+++ php-src/ext/standard/versioning.c   Mon Aug 11 19:16:54 2003
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: versioning.c,v 1.16 2003/08/05 12:34:31 sniper Exp $ */
+/* $Id: versioning.c,v 1.17 2003/08/11 23:16:54 iliaa Exp $ */
 
 #include <stdio.h>
 #include <sys/types.h>
@@ -34,7 +34,7 @@
 php_canonicalize_version(const char *version)
 {
     int len = strlen(version);
-    char *buf = emalloc(len * 2 + 1), *q, lp, lq;
+    char *buf = safe_emalloc(len, 2, 1), *q, lp, lq;
     const char *p;
 
     if (len == 0) {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to