From f5c36b8d9e064f1e4a5829b5aa8c77600f394dce Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Mon, 30 Aug 2004 22:21:13 +0000 Subject: [PATCH] MFH: Added missing input validation to dio_write(). --- ext/dio/dio.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ext/dio/dio.c b/ext/dio/dio.c index b237430eed..4e26188aa9 100644 --- a/ext/dio/dio.c +++ b/ext/dio/dio.c @@ -249,6 +249,11 @@ PHP_FUNCTION(dio_write) return; } + if (trunc_len <= 0 || trunc_len > data_len) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "length must be greater then zero and less then the length of specified string."); + RETURN_FALSE; + } + ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd); res = write(f->fd, data, trunc_len ? trunc_len : data_len); -- 2.50.1