cvs: php-src /ext/pcntl pcntl.c /ext/session mod_mm.c /ext/wddx wddx.c

From: Date: Wed, 30 Jun 2004 01:12:06 +0000
Subject: cvs: php-src /ext/pcntl pcntl.c /ext/session mod_mm.c /ext/wddx wddx.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-27731@lists.php.net to get a copy of this message
iliaa Tue Jun 29 21:12:06 2004 EDT Modified files: /php-src/ext/wddx wddx.c /php-src/ext/pcntl pcntl.c /php-src/ext/session mod_mm.c Log: Do not use alloca() where it can be abused through user input. http://cvs.php.net/diff.php/php-src/ext/wddx/wddx.c?r1=1.110&r2=1.111&ty=u Index: php-src/ext/wddx/wddx.c diff -u php-src/ext/wddx/wddx.c:1.110 php-src/ext/wddx/wddx.c:1.111 --- php-src/ext/wddx/wddx.c:1.110 Sun Feb 29 00:21:36 2004 +++ php-src/ext/wddx/wddx.c Tue Jun 29 21:12:03 2004 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: wddx.c,v 1.110 2004/02/29 05:21:36 moriyoshi Exp $ */ +/* $Id: wddx.c,v 1.111 2004/06/30 01:12:03 iliaa Exp $ */ #include "php.h" @@ -1062,7 +1062,7 @@ case ST_DATETIME: { char *tmp; - tmp = do_alloca(len + 1); + tmp = emalloc(len + 1); memcpy(tmp, s, len); tmp[len] = '\0'; @@ -1073,7 +1073,7 @@ Z_STRLEN_P(ent->data) = len; Z_STRVAL_P(ent->data) = estrndup(s, len); } - free_alloca(tmp); + efree(tmp); } break; http://cvs.php.net/diff.php/php-src/ext/pcntl/pcntl.c?r1=1.43&r2=1.44&ty=u Index: php-src/ext/pcntl/pcntl.c diff -u php-src/ext/pcntl/pcntl.c:1.43 php-src/ext/pcntl/pcntl.c:1.44 --- php-src/ext/pcntl/pcntl.c:1.43 Fri Jan 23 02:02:15 2004 +++ php-src/ext/pcntl/pcntl.c Tue Jun 29 21:12:04 2004 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pcntl.c,v 1.43 2004/01/23 07:02:15 sniper Exp $ */ +/* $Id: pcntl.c,v 1.44 2004/06/30 01:12:04 iliaa Exp $ */ #define PCNTL_DEBUG 0 @@ -434,7 +434,7 @@ args_hash = HASH_OF(args); argc = zend_hash_num_elements(args_hash); - argv = alloca((argc+2) * sizeof(char *)); + argv = safe_emalloc((argc + 2), sizeof(char *), 0); *argv = path; for ( zend_hash_internal_pointer_reset(args_hash), current_arg = argv+1; (argi < argc && (zend_hash_get_current_data(args_hash, (void **) &element) == SUCCESS)); @@ -445,7 +445,7 @@ } *(current_arg) = NULL; } else { - argv = alloca(2 * sizeof(char *)); + argv = emalloc(2 * sizeof(char *)); *argv = path; *(argv+1) = NULL; } @@ -455,13 +455,13 @@ envs_hash = HASH_OF(envs); envc = zend_hash_num_elements(envs_hash); - envp = alloca((envc+1) * sizeof(char *)); + envp = safe_emalloc((envc + 1), sizeof(char *), 0); for ( zend_hash_internal_pointer_reset(envs_hash), pair = envp; (envi < envc && (zend_hash_get_current_data(envs_hash, (void **) &element) == SUCCESS)); (envi++, pair++, zend_hash_move_forward(envs_hash)) ) { switch (return_val = zend_hash_get_current_key_ex(envs_hash, &key, &key_length, &key_num, 0, NULL)) { case HASH_KEY_IS_LONG: - key = alloca(101); + key = emalloc(101); snprintf(key, 100, "%ld", key_num); key_length = strlen(key); break; @@ -480,7 +480,7 @@ strlcat(*pair, Z_STRVAL_PP(element), pair_length); /* Cleanup */ - if (return_val == HASH_KEY_IS_LONG) free_alloca(key); + if (return_val == HASH_KEY_IS_LONG) efree(key); } *(pair) = NULL; } @@ -492,10 +492,10 @@ /* Cleanup */ if (envp != NULL) { for (pair = envp; *pair != NULL; pair++) efree(*pair); - free_alloca(envp); + efree(envp); } - free_alloca(argv); + efree(argv); RETURN_FALSE; } http://cvs.php.net/diff.php/php-src/ext/session/mod_mm.c?r1=1.44&r2=1.45&ty=u Index: php-src/ext/session/mod_mm.c diff -u php-src/ext/session/mod_mm.c:1.44 php-src/ext/session/mod_mm.c:1.45 --- php-src/ext/session/mod_mm.c:1.44 Thu Jan 8 03:17:23 2004 +++ php-src/ext/session/mod_mm.c Tue Jun 29 21:12:06 2004 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mod_mm.c,v 1.44 2004/01/08 08:17:23 andi Exp $ */ +/* $Id: mod_mm.c,v 1.45 2004/06/30 01:12:06 iliaa Exp $ */ #include "php.h" @@ -264,7 +264,7 @@ return FAILURE; /* Directory + '/' + File + Module Name + Effective UID + \0 */ - ps_mm_path = do_alloca(save_path_len+1+sizeof(PS_MM_FILE)+mod_name_len+strlen(euid)+1); + ps_mm_path = emalloc(save_path_len+1+sizeof(PS_MM_FILE)+mod_name_len+strlen(euid)+1); memcpy(ps_mm_path, PS(save_path), save_path_len + 1); if (save_path_len > 0 && ps_mm_path[save_path_len - 1] != DEFAULT_SLASH) { @@ -277,7 +277,7 @@ ret = ps_mm_initialize(ps_mm_instance, ps_mm_path); - free_alloca(ps_mm_path); + efree(ps_mm_path); if (ret != SUCCESS) { free(ps_mm_instance);

« previous php.cvs (#27731) next »