mirror of
https://github.com/php/php-src.git
synced 2024-12-01 05:43:38 +08:00
Fixed possible crash inside dio_read().
This commit is contained in:
parent
8eacea8b48
commit
4ca88997f7
@ -215,6 +215,11 @@ PHP_FUNCTION(dio_read)
|
||||
|
||||
ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
|
||||
|
||||
if (bytes <= 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0.");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
data = emalloc(bytes + 1);
|
||||
res = read(f->fd, data, bytes);
|
||||
if (res <= 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user