Skip to content

Commit

Permalink
Merge branch 'PHP-8.3'
Browse files Browse the repository at this point in the history
* PHP-8.3:
  Fix GH-13984: Buffer size is now checked before memcmp (#13991)
  • Loading branch information
SakiTakamachi committed Apr 17, 2024
2 parents e23440e + dd5cdfd commit d14b208
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ext/pdo_sqlite/sqlite_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,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) {
Expand Down
18 changes: 18 additions & 0 deletions ext/pdo_sqlite/tests/gh13991.phpt
Original file line number Diff line number Diff line change
@@ -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!

0 comments on commit d14b208

Please sign in to comment.