Merge branch 'PHP-8.2' into PHP-8.3

* PHP-8.2:
  Fix GH-13984: Buffer size is now checked before memcmp (#13991)
This commit is contained in:
Saki Takamachi 2024-04-18 08:37:55 +09:00
commit dd5cdfd645
No known key found for this signature in database
GPG key ID: E4A36F6D37931A8B
3 changed files with 22 additions and 1 deletions

3
NEWS
View file

@ -37,6 +37,9 @@ PHP NEWS
. Fixed bug GH-10495 (feof on OpenSSL stream hangs indefinitely). . Fixed bug GH-10495 (feof on OpenSSL stream hangs indefinitely).
(Jakub Zelenka) (Jakub Zelenka)
- PDO SQLite:
. Fix GH-13984 (Buffer size is now checked before memcmp). (Saki Takamachi)
- Phar: - Phar:
. Fixed bug GH-13836 (Renaming a file in a Phar to an already existing . Fixed bug GH-13836 (Renaming a file in a Phar to an already existing
filename causes a NULL pointer dereference). (nielsdos) filename causes a NULL pointer dereference). (nielsdos)

View file

@ -738,7 +738,7 @@ static char *make_filename_safe(const char *filename)
} }
return estrdup(filename); return estrdup(filename);
} }
if (*filename && memcmp(filename, ":memory:", sizeof(":memory:"))) { if (*filename && strcmp(filename, ":memory:")) {
char *fullpath = expand_filepath(filename, NULL); char *fullpath = expand_filepath(filename, NULL);
if (!fullpath) { if (!fullpath) {

View file

@ -0,0 +1,18 @@
--TEST--
Fix GH-13984: Buffer size is now checked before memcmp
--EXTENSIONS--
pdo_sqlite
--SKIPIF--
<?php if (file_exists(getcwd() . '/13991db')) die('skip File "13991db" already exists.'); ?>
--FILE--
<?php
$dbfile = '13991db';
$db = new PDO('sqlite:' . $dbfile, null, null, [PDO::ATTR_PERSISTENT => true]);
echo 'done!';
?>
--CLEAN--
<?php
@unlink(getcwd() . '/13991db');
?>
--EXPECT--
done!