]> granicus.if.org Git - php/commitdiff
MFH: Added missing input validation to dio_write().
authorIlia Alshanetsky <iliaa@php.net>
Mon, 30 Aug 2004 22:21:13 +0000 (22:21 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Mon, 30 Aug 2004 22:21:13 +0000 (22:21 +0000)
ext/dio/dio.c

index b237430eedb842549f054eb18fcff1233a997ff1..4e26188aa951fa96fb5e396b5924ba08af8d1434 100644 (file)
@@ -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);