diff options
author | Jason Greene <jason@php.net> | 2002-05-06 19:48:39 +0000 |
---|---|---|
committer | Jason Greene <jason@php.net> | 2002-05-06 19:48:39 +0000 |
commit | 4c9dbf93352d938c714dfe9527a0fa7f268745c9 (patch) | |
tree | 34b64127b76b90ef5d513a927fec7e363e25a766 /ext/pcntl | |
parent | ebede147aaff3aee36ccf17679e01e99fe418c3d (diff) | |
download | php-git-4c9dbf93352d938c714dfe9527a0fa7f268745c9.tar.gz |
Fix type-o that broke ZTS build
Fix 3 nasty crash bugs that could occur if pcntl_exec's call to execve errored
Diffstat (limited to 'ext/pcntl')
-rwxr-xr-x | ext/pcntl/pcntl.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c index aa5a90d28c..4fdbd1f15c 100755 --- a/ext/pcntl/pcntl.c +++ b/ext/pcntl/pcntl.c @@ -396,6 +396,8 @@ PHP_FUNCTION(pcntl_exec) for ( zend_hash_internal_pointer_reset(args_hash), current_arg = argv+1; (argi < argc && (zend_hash_get_current_data(args_hash, (void **) &element) == SUCCESS)); (argi++, current_arg++, zend_hash_move_forward(args_hash)) ) { + + convert_to_string_ex(element); *current_arg = Z_STRVAL_PP(element); } *(current_arg) = NULL; @@ -424,6 +426,9 @@ PHP_FUNCTION(pcntl_exec) pair--; continue; } + + convert_to_string_ex(element); + /* Length of element + equal sign + length of key + null */ pair_length = Z_STRLEN_PP(element) + key_length + 2; *pair = emalloc(pair_length); @@ -439,14 +444,16 @@ PHP_FUNCTION(pcntl_exec) if (execve(path, argv, envp) == -1) { php_error(E_WARNING, "Error has occured in %s: (errno %d) %s", - get_active_function_name(TSRMLS_CC), errno, strerror(errno)); + get_active_function_name(TSRMLS_C), errno, strerror(errno)); } /* Cleanup */ - for (pair = envp; *pair != NULL; pair++) efree(*pair); - + if (envp != NULL) { + for (pair = envp; *pair != NULL; pair++) efree(*pair); + free_alloca(envp); + } + free_alloca(argv); - free_alloca(envp); RETURN_FALSE; } |