[php-src] master: Merge branch 'PHP-8.2' into PHP-8.3
| From: | Saki Takamachi | Date: | Wed, 17 Apr 2024 23:39:36 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.2' into PHP-8.3 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-128154@lists.php.net to get a copy of this message | ||
Author: Saki Takamachi (SakiTakamachi)
Date: 2024-04-18T08:37:55+09:00
Commit: https://github.com/php/php-src/commit/dd5cdfd645160cdf93cad05ef17bf10bf380893a
Raw diff: https://github.com/php/php-src/commit/dd5cdfd645160cdf93cad05ef17bf10bf380893a.diff
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
Fix GH-13984: Buffer size is now checked before memcmp (#13991)
Changed paths:
A ext/pdo_sqlite/tests/gh13991.phpt
M NEWS
M ext/pdo_sqlite/sqlite_driver.c
Diff:
diff --git a/NEWS b/NEWS
index be3b6cfbe9ed0..27864da656bec 100644
--- a/NEWS
+++ b/NEWS
@@ -37,6 +37,9 @@ PHP NEWS
. Fixed bug GH-10495 (feof on OpenSSL stream hangs indefinitely).
(Jakub Zelenka)
+- PDO SQLite:
+ . Fix GH-13984 (Buffer size is now checked before memcmp). (Saki Takamachi)
+
- Phar:
. Fixed bug GH-13836 (Renaming a file in a Phar to an already existing
filename causes a NULL pointer dereference). (nielsdos)
diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c
index f83ce43a3ce8b..3af9aed3521f7 100644
--- a/ext/pdo_sqlite/sqlite_driver.c
+++ b/ext/pdo_sqlite/sqlite_driver.c
@@ -738,7 +738,7 @@ static char *make_filename_safe(const char *filename)
}
return estrdup(filename);
}
- if (*filename && memcmp(filename, ":memory:", sizeof(":memory:"))) {
+ if (*filename && strcmp(filename, ":memory:")) {
char *fullpath = expand_filepath(filename, NULL);
if (!fullpath) {
diff --git a/ext/pdo_sqlite/tests/gh13991.phpt b/ext/pdo_sqlite/tests/gh13991.phpt
new file mode 100644
index 0000000000000..fa847f8ba5b42
--- /dev/null
+++ b/ext/pdo_sqlite/tests/gh13991.phpt
@@ -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!