From 3bdf8fda7f958efa949e01f793d50b13577f1339 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Mon, 23 Aug 2004 17:27:53 +0000 Subject: [PATCH] MFH: Fixed possible crash inside dio_read(). --- ext/dio/dio.c | 5 +++++ 1 file changed, 5 insertions(+) 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) { -- 2.50.1