Skip to content

Commit

Permalink
fix panic in prepared sql
Browse files Browse the repository at this point in the history
  • Loading branch information
maksymnevajdev authored and jackc committed Dec 2, 2023
1 parent 4678e69 commit 319c317
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/sanitize/sanitize.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down

0 comments on commit 319c317

Please sign in to comment.