summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schlüter <johannes@php.net>2012-06-22 12:48:39 +0200
committerJohannes Schlüter <johannes@php.net>2012-06-22 12:48:39 +0200
commit055ecbc62878e86287d742c7246c21606cee8183 (patch)
treebd3ccc2a6e7b9de3eb256ca5e892913966417555
parentd93892de7a56ef6312d923d63757c792e3acf522 (diff)
downloadphp-git-055ecbc62878e86287d742c7246c21606cee8183.tar.gz
Improve check for :memory: pseudo-filename in SQlite
-rw-r--r--ext/pdo_sqlite/sqlite_driver.c2
-rw-r--r--ext/sqlite3/sqlite3.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c
index 115b3e2da2..6d469d90c5 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 529f3f7f08..e793206624 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