diff --git a/internal/sanitize/sanitize.go b/internal/sanitize/sanitize.go index 173523d95..e0ae9bedb 100644 --- a/internal/sanitize/sanitize.go +++ b/internal/sanitize/sanitize.go @@ -151,7 +151,7 @@ func QuoteString(dst []byte, str string) []byte { dst = append(dst, quote...) - p := slices.Grow(dst[len(dst):], len(str)+2*n) + p := slices.Grow(dst[len(dst):], 2*len(quote)+len(str)+2*n) for len(str) > 0 { i := strings.Index(str, quote) diff --git a/internal/sanitize/sanitize_fuzz_test.go b/internal/sanitize/sanitize_fuzz_test.go index a8f2e7791..2f0c41223 100644 --- a/internal/sanitize/sanitize_fuzz_test.go +++ b/internal/sanitize/sanitize_fuzz_test.go @@ -1,6 +1,7 @@ package sanitize_test import ( + "strings" "testing" "github.com/jackc/pgx/v5/internal/sanitize"