From: Ilia Alshanetsky Date: Mon, 23 Aug 2004 17:27:46 +0000 (+0000) Subject: MFH: Fixed possible crash inside dio_read(). X-Git-Tag: php-5.0.2RC1~104 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6f20f9d285d107fa4648fd2a8be5e18fe8988ee2;p=php MFH: Fixed possible crash inside dio_read(). --- diff --git a/ext/dio/dio.c b/ext/dio/dio.c index 5f965766ab..b237430eed 100644 --- a/ext/dio/dio.c +++ b/ext/dio/dio.c @@ -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) {