From: Ilia Alshanetsky Date: Mon, 30 Aug 2004 22:21:13 +0000 (+0000) Subject: MFH: Added missing input validation to dio_write(). X-Git-Tag: php-5.0.2RC1~58 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f5c36b8d9e064f1e4a5829b5aa8c77600f394dce;p=php MFH: Added missing input validation to dio_write(). --- 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);