diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2007-01-02 14:40:32 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2007-01-02 14:40:32 +0000 |
commit | 5ed521bc6d762ce75cb41e0206260e22f08df9b3 (patch) | |
tree | 7b19b6987b10b56d15dc2f0cb7e2b2ff71f573fc | |
parent | c8123f93f0ff6c6ed827e0bbb901cc501995cd18 (diff) | |
download | php-git-5ed521bc6d762ce75cb41e0206260e22f08df9b3.tar.gz |
Added length parameter validator to zip_entry_read()
-rw-r--r-- | ext/zip/zip.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/zip/zip.c b/ext/zip/zip.c index 7cff07f21f..4b6a828cd4 100644 --- a/ext/zip/zip.c +++ b/ext/zip/zip.c @@ -283,7 +283,7 @@ PHP_FUNCTION(zip_entry_open) } /* }}} */ -/* {{{ proto string zip_entry_read(resource zip_ent) +/* {{{ proto string zip_entry_read(resource zip_ent [, int nbytes]) Read X bytes from an opened zip entry */ PHP_FUNCTION(zip_entry_read) { @@ -296,6 +296,10 @@ PHP_FUNCTION(zip_entry_read) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &zzip_ent, &len) == FAILURE) { return; } + if (len <= 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The bytes parameter must greater then zero"); + RETURN_FALSE; + } ZEND_FETCH_RESOURCE(entry, php_zzip_dirent *, &zzip_ent, -1, le_zip_entry_name, le_zip_entry); buf = emalloc(len + 1); |