fix panic in prepared sql

pull/1821/head
maksymnevajdev 2023-12-01 09:48:30 +03:00 committed by Jack Christensen
parent 4678e69599
commit 319c3172f2
1 changed files with 5 additions and 0 deletions
internal/sanitize

View File

@ -35,6 +35,11 @@ func (q *Query) Sanitize(args ...any) (string, error) {
str = part
case int:
argIdx := part - 1
if argIdx < 0 {
return "", fmt.Errorf("first sql argument must be > 0")
}
if argIdx >= len(args) {
return "", fmt.Errorf("insufficient arguments")
}