]> granicus.if.org Git - php/commitdiff
MFB: Fixed a possible memory corruption in dbase_open() with invalid open
authorIlia Alshanetsky <iliaa@php.net>
Fri, 1 Dec 2006 19:10:59 +0000 (19:10 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Fri, 1 Dec 2006 19:10:59 +0000 (19:10 +0000)
mode

ext/dbase/dbase.c
ext/dbase/tests/002.phpt

index 23fd5eb6297ac26f94c832a1cca2f320caf29dc4..6859ecacec37f64dee7b22c11587d0bdcacdda82 100644 (file)
@@ -136,7 +136,7 @@ PHP_FUNCTION(dbase_open)
        if (Z_LVAL_PP(options) == 1) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot open %s in write-only mode", Z_STRVAL_PP(dbf_name));
                RETURN_FALSE;
-       } else if (Z_LVAL_PP(options) < 0) {
+       } else if (Z_LVAL_PP(options) < 0 || Z_LVAL_PP(options) > 3) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid access mode %ld", Z_LVAL_PP(options));
                RETURN_FALSE;
        }
index 408c87c30bb484ef7543b551fdbc27ce8ba3bc36..f76be4f2638664a7824e629700e71baa287898c4 100644 (file)
@@ -38,7 +38,7 @@ echo "Done\n";
 Warning: dbase_open(): Invalid access mode -1 %s in %s on line %d
 bool(false)
 
-Warning: dbase_open(): unable to open database %s in %s on line %d
+Warning: dbase_open(): Invalid access mode 1000 in %s on line %d
 bool(false)
 
 Warning: dbase_open(): unable to open database %s in %s on line %d