]> granicus.if.org Git - php/commitdiff
Check length of string before comparing to :memory:
authorNikita Popov <nikic@php.net>
Sat, 13 Feb 2016 17:01:50 +0000 (18:01 +0100)
committerNikita Popov <nikic@php.net>
Sat, 13 Feb 2016 17:01:50 +0000 (18:01 +0100)
ext/sqlite3/sqlite3.c

index f7f76cd3fb3afb270b73a7ddf66a986306a63cf0..ce9472a71411554aebcc4d5bc848dd524e158144 100644 (file)
@@ -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;