]> granicus.if.org Git - php/commitdiff
MFH: Fixed possible crash inside dio_read().
authorIlia Alshanetsky <iliaa@php.net>
Mon, 23 Aug 2004 17:27:46 +0000 (17:27 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Mon, 23 Aug 2004 17:27:46 +0000 (17:27 +0000)
ext/dio/dio.c

index 5f965766abefd872413fbb3b8490424787558378..b237430eedb842549f054eb18fcff1233a997ff1 100644 (file)
@@ -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) {