cvs: php-src(PHP_4_4) /ext/zip zip.c

From: Date: Tue, 02 Jan 2007 14:40:32 +0000
Subject: cvs: php-src(PHP_4_4) /ext/zip zip.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-42515@lists.php.net to get a copy of this message
iliaa Tue Jan 2 14:40:32 2007 UTC Modified files: (Branch: PHP_4_4) /php-src/ext/zip zip.c Log: Added length parameter validator to zip_entry_read() http://cvs.php.net/viewvc.cgi/php-src/ext/zip/zip.c?r1=1.33.2.3.2.2&r2=1.33.2.3.2.3&diff_format=u Index: php-src/ext/zip/zip.c diff -u php-src/ext/zip/zip.c:1.33.2.3.2.2 php-src/ext/zip/zip.c:1.33.2.3.2.3 --- php-src/ext/zip/zip.c:1.33.2.3.2.2 Mon Jan 1 09:46:50 2007 +++ php-src/ext/zip/zip.c Tue Jan 2 14:40:32 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zip.c,v 1.33.2.3.2.2 2007/01/01 09:46:50 sebastian Exp $ */ +/* $Id: zip.c,v 1.33.2.3.2.3 2007/01/02 14:40:32 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -283,7 +283,7 @@ } /* }}} */ -/* {{{ 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 @@ 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);

« previous php.cvs (#42515) next »