close statement when missing query arguments

fixes #1280
This commit is contained in:
Yasuhiro Matsumoto 2024-10-04 23:52:25 +09:00
parent 846fea6c14
commit 6cc847b133
No known key found for this signature in database
GPG Key ID: F2EA90DF2C146D1E
1 changed files with 1 additions and 0 deletions

View File

@ -929,6 +929,7 @@ func (c *SQLiteConn) query(ctx context.Context, query string, args []driver.Name
s.(*SQLiteStmt).cls = true
na := s.NumInput()
if len(args)-start < na {
s.Close()
return nil, fmt.Errorf("not enough args to execute query: want %d got %d", na, len(args)-start)
}
// consume the number of arguments used in the current