Merge branch 'PHP-8.0' into PHP-8.1

* PHP-8.0:
  Fix GH-9032: SQLite3 authorizer crashes on NULL values
This commit is contained in:
Christoph M. Becker 2022-07-27 13:05:30 +02:00
commit ca84d06bbc
No known key found for this signature in database
GPG key ID: D66C9593118BCCB6
5 changed files with 64 additions and 2 deletions

View file

@ -738,6 +738,9 @@ static const struct pdo_dbh_methods sqlite_methods = {
static char *make_filename_safe(const char *filename)
{
if (!filename) {
return NULL;
}
if (*filename && strncasecmp(filename, "file:", 5) == 0) {
if (PG(open_basedir) && *PG(open_basedir)) {
return NULL;
@ -766,7 +769,7 @@ static int authorizer(void *autharg, int access_type, const char *arg3, const ch
char *filename;
switch (access_type) {
case SQLITE_COPY: {
filename = make_filename_safe(arg4);
filename = make_filename_safe(arg4);
if (!filename) {
return SQLITE_DENY;
}
@ -775,7 +778,7 @@ static int authorizer(void *autharg, int access_type, const char *arg3, const ch
}
case SQLITE_ATTACH: {
filename = make_filename_safe(arg3);
filename = make_filename_safe(arg3);
if (!filename) {
return SQLITE_DENY;
}