com php-src: Merge branch 'PHP-7.1' into PHP-7.2: ext/sqlite3/sqlite3.c
| From: | Remi Collet | Date: | Wed, 29 May 2019 06:45:04 +0000 |
| Subject: | com php-src: Merge branch 'PHP-7.1' into PHP-7.2: ext/sqlite3/sqlite3.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-106418@lists.php.net to get a copy of this message | ||
Commit: 750687806d8b5a5ec88d88ecc14a422e58ad8d66
Author: Stanislav Malyshev <stas@php.net> Mon, 27 May 2019 21:36:00 -0700
Committer: Remi Collet <remi@php.net> Wed, 29 May 2019 08:45:04 +0200
Parents: 810161b704f3770852270f7f2df6464974f335f0
Branches: PHP-7.2.19
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=750687806d8b5a5ec88d88ecc14a422e58ad8d66
Log:
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
Fix bug #77967 - Bypassing open_basedir restrictions via file uris
Bugs:
https://bugs.php.net/77967
Changed paths:
M ext/sqlite3/sqlite3.c
Diff:
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
index a7df269..ac98435 100644
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.c
@@ -2071,6 +2071,15 @@ static int php_sqlite3_authorizer(void *autharg, int access_type, const char
*ar
case SQLITE_ATTACH:
{
if (memcmp(arg3, ":memory:", sizeof(":memory:")) && *arg3) {
+ if (strncmp(arg3, "file:", 5) == 0) {
+ /* starts with "file:" */
+ if (!arg3[5]) {
+ return SQLITE_DENY;
+ }
+ if (php_check_open_basedir(arg3 + 5)) {
+ return SQLITE_DENY;
+ }
+ }
if (php_check_open_basedir(arg3)) {
return SQLITE_DENY;
}