summaryrefslogtreecommitdiff
path: root/ext/sqlite/sqlite.c
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2010-11-18 15:22:22 +0000
committerPierre Joye <pajoye@php.net>2010-11-18 15:22:22 +0000
commitce96fd6b0761d98353761bf78d5bfb55291179fd (patch)
tree0b66c858477f5ac7472bf35b842f89cdf4dce151 /ext/sqlite/sqlite.c
parent75631ab8ac231f141286428fd871ad31f2d71588 (diff)
downloadphp-git-ce96fd6b0761d98353761bf78d5bfb55291179fd.tar.gz
- fix #39863, do not accept paths with NULL in them. See http://news.php.net/php.internals/50191, trunk will have the patch later (adding a macro and/or changing (some) APIs. Patch by Rasmus
Diffstat (limited to 'ext/sqlite/sqlite.c')
-rw-r--r--ext/sqlite/sqlite.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/sqlite/sqlite.c b/ext/sqlite/sqlite.c
index 5fc562eeab..c9673e868b 100644
--- a/ext/sqlite/sqlite.c
+++ b/ext/sqlite/sqlite.c
@@ -1560,6 +1560,9 @@ PHP_FUNCTION(sqlite_popen)
ZVAL_NULL(errmsg);
}
+ if (strlen(filename) != filename_len) {
+ RETURN_FALSE;
+ }
if (strncmp(filename, ":memory:", sizeof(":memory:") - 1)) {
/* resolve the fully-qualified path name to use as the hash key */
if (!(fullpath = expand_filepath(filename, NULL TSRMLS_CC))) {
@@ -1637,6 +1640,9 @@ PHP_FUNCTION(sqlite_open)
ZVAL_NULL(errmsg);
}
+ if (strlen(filename) != filename_len) {
+ RETURN_FALSE;
+ }
if (strncmp(filename, ":memory:", sizeof(":memory:") - 1)) {
/* resolve the fully-qualified path name to use as the hash key */
if (!(fullpath = expand_filepath(filename, NULL TSRMLS_CC))) {
@@ -1690,6 +1696,10 @@ PHP_FUNCTION(sqlite_factory)
ZVAL_NULL(errmsg);
}
+ if (strlen(filename) != filename_len) {
+ RETURN_FALSE;
+ }
+
if (strncmp(filename, ":memory:", sizeof(":memory:") - 1)) {
/* resolve the fully-qualified path name to use as the hash key */
if (!(fullpath = expand_filepath(filename, NULL TSRMLS_CC))) {