com php-src: add overflow check: main/streams/plain_wrapper .c
| From: | Anatol Belski | Date: | Wed, 02 Sep 2015 15:05:45 +0000 |
| Subject: | com php-src: add overflow check: main/streams/plain_wrapper .c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-88860@lists.php.net to get a copy of this message | ||
Commit: 9d82a7dc9844281b17a4e20c744dd0271c657e51
Author: Anatol Belski <ab@php.net> Mon, 31 Aug 2015 21:48:14 +0200
Parents: 95ac77995658ff607472c80015ece6a7db7c2470
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9d82a7dc9844281b17a4e20c744dd0271c657e51
Log:
add overflow check
Changed paths:
M main/streams/plain_wrapper.c
Diff:
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index 101fe4a..066f778 100644
--- a/main/streams/plain_wrapper.c
+++ b/main/streams/plain_wrapper.c
@@ -336,7 +336,11 @@ static size_t php_stdiop_write(php_stream *stream, const char *buf, size_t
count
if (data->fd >= 0) {
#ifdef PHP_WIN32
- int bytes_written = write(data->fd, buf, (unsigned int)count);
+ int bytes_written;
+ if (ZEND_SIZE_T_UINT_OVFL(count)) {
+ count = UINT_MAX;
+ }
+ bytes_written = _write(data->fd, buf, (unsigned int)count);
#else
int bytes_written = write(data->fd, buf, count);
#endif