From 4ca88997f7260e0bb51c3dc18195068498369603 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Mon, 23 Aug 2004 17:27:33 +0000 Subject: [PATCH] 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 5f965766abe..b237430eedb 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) {