cvs: php4 /ext/standard exec.c
| From: | Derick Rethans | Date: | Thu, 23 May 2002 07:52:04 +0000 |
| Subject: | cvs: php4 /ext/standard exec.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-12058@lists.php.net to get a copy of this message | ||
derick Thu May 23 03:52:04 2002 EDT
Modified files:
/php4/ext/standard exec.c
Log:
- Fix unchecked return values with parameters to proc_open. (Fixes
bug #17375)
Index: php4/ext/standard/exec.c
diff -u php4/ext/standard/exec.c:1.74 php4/ext/standard/exec.c:1.75
--- php4/ext/standard/exec.c:1.74 Sun May 5 13:14:12 2002
+++ php4/ext/standard/exec.c Thu May 23 03:52:03 2002
@@ -15,7 +15,7 @@
| Author: Rasmus Lerdorf |
+----------------------------------------------------------------------+
*/
-/* $Id: exec.c,v 1.74 2002/05/05 17:14:12 stas Exp $ */
+/* $Id: exec.c,v 1.75 2002/05/23 07:52:03 derick Exp $ */
#include <stdio.h>
#include "php.h"
@@ -747,15 +747,25 @@
goto exit_fail;
} else {
- zend_hash_index_find(Z_ARRVAL_PP(descitem), 0, (void **)&ztype);
- convert_to_string_ex(ztype);
+ if (zend_hash_index_find(Z_ARRVAL_PP(descitem), 0, (void **)&ztype) == SUCCESS) {
+ convert_to_string_ex(ztype);
+ } else {
+ php_error (E_WARNING, "%s(): Missing handle qualifier in array",
+ get_active_function_name(TSRMLS_C), Z_STRVAL_PP(ztype));
+ goto exit_fail;
+ }
if (strcmp(Z_STRVAL_PP(ztype), "pipe") == 0) {
descriptor_t newpipe[2];
zval **zmode;
- zend_hash_index_find(Z_ARRVAL_PP(descitem), 1, (void **)&zmode);
- convert_to_string_ex(zmode);
+ if (zend_hash_index_find(Z_ARRVAL_PP(descitem), 1, (void **)&zmode) == SUCCESS) {
+ convert_to_string_ex(zmode);
+ } else {
+ php_error (E_WARNING, "%s(): Missing mode parameter for 'pipe'",
+ get_active_function_name(TSRMLS_C), Z_STRVAL_PP(ztype));
+ goto exit_fail;
+ }
descriptors[ndesc].mode = DESC_PIPE;
@@ -793,11 +803,21 @@
descriptors[ndesc].mode = DESC_FILE;
- zend_hash_index_find(Z_ARRVAL_PP(descitem), 1, (void **)&zfile);
- convert_to_string_ex(zfile);
+ if (zend_hash_index_find(Z_ARRVAL_PP(descitem), 1, (void **)&zfile) == SUCCESS) {
+ convert_to_string_ex(zfile);
+ } else {
+ php_error (E_WARNING, "%s(): Missing file name parameter for 'file'",
+ get_active_function_name(TSRMLS_C), Z_STRVAL_PP(ztype));
+ goto exit_fail;
+ }
- zend_hash_index_find(Z_ARRVAL_PP(descitem), 2, (void **)&zmode);
- convert_to_string_ex(zmode);
+ if (zend_hash_index_find(Z_ARRVAL_PP(descitem), 2, (void **)&zmode) == SUCCESS) {
+ convert_to_string_ex(zmode);
+ } else {
+ php_error (E_WARNING, "%s(): Missing mode parameter for 'file'",
+ get_active_function_name(TSRMLS_C), Z_STRVAL_PP(ztype));
+ goto exit_fail;
+ }
/* try a wrapper */