Skip to content

Commit 9d473f1

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fix bug #77967 - Bypassing open_basedir restrictions via file uris
2 parents 13dffa9 + fbb6a27 commit 9d473f1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ext/sqlite3/sqlite3.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2067,6 +2067,15 @@ static int php_sqlite3_authorizer(void *autharg, int access_type, const char *ar
20672067
case SQLITE_ATTACH:
20682068
{
20692069
if (memcmp(arg3, ":memory:", sizeof(":memory:")) && *arg3) {
2070+
if (strncmp(arg3, "file:", 5) == 0) {
2071+
/* starts with "file:" */
2072+
if (!arg3[5]) {
2073+
return SQLITE_DENY;
2074+
}
2075+
if (php_check_open_basedir(arg3 + 5)) {
2076+
return SQLITE_DENY;
2077+
}
2078+
}
20702079
if (php_check_open_basedir(arg3)) {
20712080
return SQLITE_DENY;
20722081
}

0 commit comments

Comments
 (0)