Skip to content

Commit fece24f

Browse files
committed
Check length of string before comparing to :memory:
1 parent 4e0134c commit fece24f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ext/sqlite3/sqlite3.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ PHP_METHOD(sqlite3, open)
123123
if (strlen(filename) != filename_len) {
124124
return;
125125
}
126-
if (memcmp(filename, ":memory:", sizeof(":memory:")) != 0) {
126+
if (filename_len != sizeof(":memory:")-1 ||
127+
memcmp(filename, ":memory:", sizeof(":memory:")-1) != 0) {
127128
if (!(fullpath = expand_filepath(filename, NULL TSRMLS_CC))) {
128129
zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Unable to expand filepath", 0 TSRMLS_CC);
129130
return;

0 commit comments

Comments
 (0)