From: Ilia Alshanetsky Date: Mon, 23 Aug 2004 17:27:53 +0000 (+0000) Subject: MFH: Fixed possible crash inside dio_read(). X-Git-Tag: php-4.3.9RC2~17 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3bdf8fda7f958efa949e01f793d50b13577f1339;p=php MFH: Fixed possible crash inside dio_read(). --- diff --git a/ext/dio/dio.c b/ext/dio/dio.c index 38f858706a..90e07b6a77 100644 --- a/ext/dio/dio.c +++ b/ext/dio/dio.c @@ -199,6 +199,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) {