From d069822191ca6ec71a5a678552a937e27173b393 Mon Sep 17 00:00:00 2001 From: mattn Date: Mon, 18 Aug 2014 18:23:58 +0900 Subject: [PATCH 1/3] Check parameter count --- sqlite3.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sqlite3.go b/sqlite3.go index fc3e8ad..baa7fa3 100644 --- a/sqlite3.go +++ b/sqlite3.go @@ -159,6 +159,9 @@ func (c *SQLiteConn) Exec(query string, args []driver.Value) (driver.Result, err var res driver.Result if s.(*SQLiteStmt).s != nil { na := s.NumInput() + if na < len(args) { + return nil, errors.New("args is not enough to execute query") + } res, err = s.Exec(args[:na]) if err != nil && err != driver.ErrSkip { s.Close() From 72cb8db627c0c5539ab4fda2b866518cd10f1fbf Mon Sep 17 00:00:00 2001 From: mattn Date: Mon, 18 Aug 2014 18:48:48 +0900 Subject: [PATCH 2/3] Fixed checking parameter count --- sqlite3.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite3.go b/sqlite3.go index e2ad600..3595545 100644 --- a/sqlite3.go +++ b/sqlite3.go @@ -164,7 +164,7 @@ func (c *SQLiteConn) Exec(query string, args []driver.Value) (driver.Result, err var res driver.Result if s.(*SQLiteStmt).s != nil { na := s.NumInput() - if na < len(args) { + if len(args) < na { return nil, errors.New("args is not enough to execute query") } res, err = s.Exec(args[:na]) From abf79dbdd53a86fc1f0d81ffa8c9970c31159d81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20B=C5=82aszczyk?= Date: Wed, 20 Aug 2014 16:13:15 +0200 Subject: [PATCH 3/3] Fix for sqlite3_test import. --- sqlite3_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite3_test.go b/sqlite3_test.go index 581d289..9cc5a0e 100644 --- a/sqlite3_test.go +++ b/sqlite3_test.go @@ -14,7 +14,7 @@ import ( "testing" "time" - "./sqlite3_test" + "github.com/mattn/go-sqlite3/sqlite3_test" ) func TempFilename() string {