summaryrefslogtreecommitdiff
path: root/ext/sqlite3/sqlite3.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/sqlite3/sqlite3.c')
-rw-r--r--ext/sqlite3/sqlite3.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
index a420d5d708..0bb8616d96 100644
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.c
@@ -114,7 +114,10 @@ PHP_METHOD(sqlite3, open)
zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Already initialised DB Object", 0 TSRMLS_CC);
}
- if (strncmp(filename, ":memory:", 8) != 0) {
+ if (strlen(filename) != filename_len) {
+ return;
+ }
+ 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;
@@ -1094,7 +1097,7 @@ static int php_sqlite3_stream_close(php_stream *stream, int close_handle TSRMLS_
php_stream_sqlite3_data *sqlite3_stream = (php_stream_sqlite3_data *) stream->abstract;
if (sqlite3_blob_close(sqlite3_stream->blob) != SQLITE_OK) {
- /* Error occured, but it still closed */
+ /* Error occurred, but it still closed */
}
efree(sqlite3_stream);
@@ -1959,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