]> granicus.if.org Git - php/commitdiff
MFB: Fixed a possible crash in dbase_open() on empty filename.
authorIlia Alshanetsky <iliaa@php.net>
Wed, 22 Nov 2006 17:30:52 +0000 (17:30 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 22 Nov 2006 17:30:52 +0000 (17:30 +0000)
ext/dbase/dbase.c

index 9afe7b0f9a52389c43030f7e5f9f21594605f252..23fd5eb6297ac26f94c832a1cca2f320caf29dc4 100644 (file)
@@ -128,6 +128,11 @@ PHP_FUNCTION(dbase_open)
        convert_to_string_ex(dbf_name);
        convert_to_long_ex(options);
 
+       if (!Z_STRLEN_PP(dbf_name)) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "The filename cannot be empty.");
+               RETURN_FALSE;
+       }
+
        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;