com php-src: Add check in fgetcsv in case sizeof(unit) != sizeof(size_t): ext/standard/file.c
| From: | Stanislav Malyshev | Date: | Tue, 13 Sep 2016 04:04:23 +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-94445@lists.php.net to get a copy of this message | ||
Commit: 7381d4c00e32d86573b55540d379ef0c6da3c09d
Author: Stanislav Malyshev <stas@php.net> Sun, 11 Sep 2016 20:58:55 -0700
Parents: ecb7f58a069be0dec4a6131b6351a761f808f22e
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7381d4c00e32d86573b55540d379ef0c6da3c09d
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);