summaryrefslogtreecommitdiff
path: root/ext/zip
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2001-08-13 19:31:18 +0000
committerZeev Suraski <zeev@php.net>2001-08-13 19:31:18 +0000
commit0116a7b9112007c00446ff11245631bdb858450b (patch)
tree348421ac1d27b17c45e2a73c2a9c3ac119f1e89e /ext/zip
parentad18bd07f1892e9c3445e4b6acb4e6ada70c1a45 (diff)
downloadphp-git-0116a7b9112007c00446ff11245631bdb858450b.tar.gz
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.
Diffstat (limited to 'ext/zip')
-rw-r--r--ext/zip/zip.c35
1 files changed, 21 insertions, 14 deletions
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);