mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
add overflow check
This commit is contained in:
parent
95ac779956
commit
9d82a7dc98
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user