com php-src: Improve check for :memory: pseudo-filename in SQlite: ext/pdo_sqlite/sqlite_driver.c ext/sqlite3/sqlite3 .c
| From: | Johannes Schlüter | Date: | Fri, 22 Jun 2012 10:48:39 +0000 |
| Subject: | com php-src: Improve check for :memory: pseudo-filename in SQlite: ext/pdo_sqlite/sqlite_driver.c ext/sqlite3/sqlite3 .c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-69426@lists.php.net to get a copy of this message | ||
Commit: 055ecbc62878e86287d742c7246c21606cee8183
Author: Johannes Schlüter <johannes@php.net> Fri, 22 Jun 2012 12:48:39 +0200
Parents: d93892de7a56ef6312d923d63757c792e3acf522
Branches: PHP-5.3 PHP-5.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=055ecbc62878e86287d742c7246c21606cee8183
Log:
Improve check for :memory: pseudo-filename in SQlite
Changed paths:
M ext/pdo_sqlite/sqlite_driver.c
M ext/sqlite3/sqlite3.c
Diff:
diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c
index 115b3e2..6d469d9 100644
--- a/ext/pdo_sqlite/sqlite_driver.c
+++ b/ext/pdo_sqlite/sqlite_driver.c
@@ -760,7 +760,7 @@ static struct pdo_dbh_methods sqlite_methods = {
static char *make_filename_safe(const char *filename TSRMLS_DC)
{
- if (*filename && strncmp(filename, ":memory:", sizeof(":memory:")-1))
{
+ if (*filename && memcmp(filename, ":memory:", sizeof(":memory:"))) {
char *fullpath = expand_filepath(filename, NULL TSRMLS_CC);
if (!fullpath) {
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
index 529f3f7..e793206 100644
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.c
@@ -117,7 +117,7 @@ PHP_METHOD(sqlite3, open)
if (strlen(filename) != filename_len) {
return;
}
- if (strncmp(filename, ":memory:", 8) != 0) {
+ if (memcmp(filename, ":memory:", sizeof(":memory:")) != 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;
@@ -1962,7 +1962,7 @@ static int php_sqlite3_authorizer(void *autharg, int access_type, const char
*ar
switch (access_type) {
case SQLITE_ATTACH:
{
- if (strncmp(arg3, ":memory:", sizeof(":memory:")-1) && *arg3) {
+ if (memcmp(arg3, ":memory:", sizeof(":memory:")) && *arg3) {
TSRMLS_FETCH();
#if PHP_API_VERSION < 20100412