diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c index 7cd8880b86099..c1dcaa7fc2bca 100644 --- a/ext/pdo_sqlite/sqlite_driver.c +++ b/ext/pdo_sqlite/sqlite_driver.c @@ -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) { 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-- + +--FILE-- + true]); +echo 'done!'; +?> +--CLEAN-- + +--EXPECT-- +done!