summaryrefslogtreecommitdiff
path: root/main/streams/plain_wrapper.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2015-08-31 21:48:14 +0200
committerAnatol Belski <ab@php.net>2015-09-02 17:05:45 +0200
commit9d82a7dc9844281b17a4e20c744dd0271c657e51 (patch)
tree7537b10310c789085a15a7a0e4f0b6a6e7b90584 /main/streams/plain_wrapper.c
parent95ac77995658ff607472c80015ece6a7db7c2470 (diff)
downloadphp-git-9d82a7dc9844281b17a4e20c744dd0271c657e51.tar.gz
add overflow check
Diffstat (limited to 'main/streams/plain_wrapper.c')
-rw-r--r--main/streams/plain_wrapper.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index 101fe4aa53..066f7789a7 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