com php-src: Add check in fgetcsv in case sizeof(unit) != sizeof(size_t): ext/standard/file.c

From: Date: Thu, 15 Sep 2016 08:04:11 +0000
Subject: com php-src: Add check in fgetcsv in case sizeof(unit) != sizeof(size_t): ext/standard/file.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-94541@lists.php.net to get a copy of this message
Commit: fbd78c03ab3614c526bb5efe234fd6f845478efb Author: Stanislav Malyshev <stas@php.net> Sun, 11 Sep 2016 20:58:55 -0700 Committer: Ferenc Kovacs <tyra3l@gmail.com> Thu, 15 Sep 2016 10:04:11 +0200 Parents: 589cfc7d0ebbc2399b6cbac3351ae26d569e9600 Branches: PHP-5.6.26 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=fbd78c03ab3614c526bb5efe234fd6f845478efb Log: Add check in fgetcsv in case sizeof(unit) != sizeof(size_t) Changed paths: M ext/standard/file.c Diff: diff --git a/ext/standard/file.c b/ext/standard/file.c index 440276a..067f961 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -2301,6 +2301,10 @@ PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char /* 3. Now pass our field back to php */ *comp_end = '\0'; + if (UNEXPECTED((comp_end - temp) > INT_MAX)) { + zend_error_noreturn(E_WARNING, "String overflow, max size is %d", INT_MAX); + break; + } add_next_index_stringl(return_value, temp, comp_end - temp, 1); } while (inc_len > 0);

« previous php.cvs (#94541) next »