Skip to content

Commit ce1447e

Browse files
committed
Fix bug #77967 - Bypassing open_basedir restrictions via file uris
1 parent 1dde2ac commit ce1447e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

ext/sqlite3/sqlite3.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,8 +2012,16 @@ static int php_sqlite3_authorizer(void *autharg, int access_type, const char *ar
20122012
return SQLITE_DENY;
20132013
}
20142014
#endif
2015-
2016-
if (php_check_open_basedir(arg3 TSRMLS_CC)) {
2015+
if (strncmp(arg3, "file:", 5) == 0) {
2016+
/* starts with "file:" */
2017+
if (!arg3[5]) {
2018+
return SQLITE_DENY;
2019+
}
2020+
if (php_check_open_basedir(arg3 + 5 TSRMLS_CC)) {
2021+
return SQLITE_DENY;
2022+
}
2023+
}
2024+
if (php_check_open_basedir(arg3 TSRMLS_CC)) {
20172025
return SQLITE_DENY;
20182026
}
20192027
}

0 commit comments

Comments
 (0)