From: Zeev Suraski Date: Mon, 13 Aug 2001 19:31:18 +0000 (+0000) Subject: Fix crashes in parse_parameters calls X-Git-Tag: php-4.0.7RC1~70 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0116a7b9112007c00446ff11245631bdb858450b;p=php Fix crashes in parse_parameters calls HEADS UP: Make sure you supply TSRMLS_CC for this function! I'll try to think of a way that'd allow us to find this issue using the compiler. --- diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index 810642bb1d..7de02c1930 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -417,8 +417,9 @@ PHP_FUNCTION(snmp_set_quick_print) int argc = ZEND_NUM_ARGS(); long a1; - if (zend_parse_parameters(argc, "l", &a1) == FAILURE) + if (zend_parse_parameters(argc TSRMLS_CC, "l", &a1) == FAILURE) { return; + } snmp_set_quick_print((int)a1); } diff --git a/ext/standard/info.c b/ext/standard/info.c index 0fa5414a1d..0227db10eb 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -458,8 +458,9 @@ PHP_FUNCTION(phpinfo) int argc = ZEND_NUM_ARGS(); long flag; - if (zend_parse_parameters(argc, "|l", &flag) == FAILURE) + if (zend_parse_parameters(argc TSRMLS_CC, "|l", &flag) == FAILURE) { return; + } if(!argc) { flag = 0xFFFFFFFF; @@ -491,8 +492,9 @@ PHP_FUNCTION(phpcredits) int argc = ZEND_NUM_ARGS(); long flag; - if (zend_parse_parameters(argc, "|l", &flag) == FAILURE) + if (zend_parse_parameters(argc TSRMLS_CC, "|l", &flag) == FAILURE) { return; + } if(!argc) { flag = 0xFFFFFFFF; diff --git a/ext/zip/zip.c b/ext/zip/zip.c index dcd0046540..dc40a7f422 100644 --- a/ext/zip/zip.c +++ b/ext/zip/zip.c @@ -122,8 +122,9 @@ PHP_FUNCTION(zip_open) ZZIP_DIR *archive_p = NULL; int filename_len; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &filename, &filename_len) == FAILURE) - return; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) { + return; + } archive_p = zzip_opendir(filename); if (archive_p == NULL) { @@ -144,8 +145,9 @@ PHP_FUNCTION(zip_read) php_zzip_dirent *entry = NULL; int ret; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zzip_dp) == FAILURE) - return; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zzip_dp) == FAILURE) { + return; + } ZEND_FETCH_RESOURCE(archive_p, ZZIP_DIR *, zzip_dp, -1, le_zip_dir_name, le_zip_dir); @@ -168,8 +170,9 @@ PHP_FUNCTION(zip_close) zval **zzip_dp; ZZIP_DIR *archive_p = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zzip_dp) == FAILURE) - return; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zzip_dp) == FAILURE) { + return; + } ZEND_FETCH_RESOURCE(archive_p, ZZIP_DIR *, zzip_dp, -1, le_zip_dir_name, le_zip_dir); @@ -184,8 +187,9 @@ static void php_zzip_get_entry(INTERNAL_FUNCTION_PARAMETERS, int opt) zval **zzip_ent; php_zzip_dirent *entry = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zzip_ent) == FAILURE) - return; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zzip_ent) == FAILURE) { + return; + } ZEND_FETCH_RESOURCE(entry, php_zzip_dirent *, zzip_ent, -1, le_zip_entry_name, le_zip_entry); @@ -248,8 +252,9 @@ PHP_FUNCTION(zip_entry_open) php_zzip_dirent *entry = NULL; int mode; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr|i", &zzip_dp, &zzip_ent, &mode) == FAILURE) - return; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|i", &zzip_dp, &zzip_ent, &mode) == FAILURE) { + return; + } ZEND_FETCH_RESOURCE(archive_p, ZZIP_DIR *, zzip_dp, -1, le_zip_dir_name, le_zip_dir); ZEND_FETCH_RESOURCE(entry, php_zzip_dirent *, zzip_ent, -1, le_zip_entry_name, le_zip_entry); @@ -273,8 +278,9 @@ PHP_FUNCTION(zip_entry_read) int len = 1024; int ret = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|i", &zzip_ent, &len) == FAILURE) - return; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &zzip_ent, &len) == FAILURE) { + return; + } ZEND_FETCH_RESOURCE(entry, php_zzip_dirent *, zzip_ent, -1, le_zip_entry_name, le_zip_entry); @@ -294,8 +300,9 @@ PHP_FUNCTION(zip_entry_close) zval **zzip_ent; php_zzip_dirent *entry = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zzip_ent) == FAILURE) - return; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zzip_ent) == FAILURE) { + return; + } ZEND_FETCH_RESOURCE(entry, php_zzip_dirent *, zzip_ent, -1, le_zip_entry_name, le_zip_entry);