com php-src: Check length of string before comparing to :memory:: ext/sqlite3/sqlite3.c
| From: | Nikita Popov | Date: | Sat, 13 Feb 2016 17:01:50 +0000 |
| Subject: | com php-src: Check length of string before comparing to :memory:: ext/sqlite3/sqlite3.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-91007@lists.php.net to get a copy of this message | ||
Commit: fece24f8f4750d4fb75b89f8b9bd69046edeb5a9
Author: Nikita Popov <nikic@php.net> Sat, 13 Feb 2016 18:01:50 +0100
Parents: 4e0134c6618844f076d40fb346e78b89e98c825c
Branches: PHP-5.6 PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=fece24f8f4750d4fb75b89f8b9bd69046edeb5a9
Log:
Check length of string before comparing to :memory:
Changed paths:
M ext/sqlite3/sqlite3.c
Diff:
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
index f7f76cd..ce9472a 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;