summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2006-11-22 17:30:52 +0000
committerIlia Alshanetsky <iliaa@php.net>2006-11-22 17:30:52 +0000
commit2dbccb34d4b1acc83e45c8238630dfff8aea57c7 (patch)
treebcd8d51b1629cb5aeef5b228d10ec32da12c68f5
parent19abc4b507492669a5e3ff4a42043eab4515b9af (diff)
downloadphp-git-2dbccb34d4b1acc83e45c8238630dfff8aea57c7.tar.gz
MFB: Fixed a possible crash in dbase_open() on empty filename.
-rw-r--r--ext/dbase/dbase.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/dbase/dbase.c b/ext/dbase/dbase.c
index 9afe7b0f9a..23fd5eb629 100644
--- a/ext/dbase/dbase.c
+++ b/ext/dbase/dbase.c
@@ -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;