From fece24f8f4750d4fb75b89f8b9bd69046edeb5a9 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 13 Feb 2016 18:01:50 +0100 Subject: Check length of string before comparing to :memory: --- ext/sqlite3/sqlite3.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ext/sqlite3') diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index f7f76cd3fb..ce9472a714 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -123,7 +123,8 @@ PHP_METHOD(sqlite3, open) if (strlen(filename) != filename_len) { return; } - if (memcmp(filename, ":memory:", sizeof(":memory:")) != 0) { + if (filename_len != sizeof(":memory:")-1 || + memcmp(filename, ":memory:", sizeof(":memory:")-1) != 0) { if (!(fullpath = expand_filepath(filename, NULL TSRMLS_CC))) { zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Unable to expand filepath", 0 TSRMLS_CC); return; -- cgit v1.2.1