]> Cypherpunks repositories - gostls13.git/commit
net/textproto: avoid quadratic complexity in Reader.ReadResponse
authorDamien Neil <dneil@google.com>
Tue, 30 Sep 2025 22:11:16 +0000 (15:11 -0700)
committerGopher Robot <gobot@golang.org>
Tue, 7 Oct 2025 19:46:30 +0000 (12:46 -0700)
commit5ede095649db7783726c28390812bca9ce2c684a
tree2a2e04827c34a79bc5c97d19e1917cac716cebf4
parent5ce8cd16f3859ec5ac4106ad8ec15d6236f4501b
net/textproto: avoid quadratic complexity in Reader.ReadResponse

Reader.ReadResponse constructed a response string from repeated
string concatenation, permitting a malicious sender to cause excessive
memory allocation and CPU consumption by sending a response consisting
of many short lines.

Use a strings.Builder to construct the string instead.

Thanks to Jakub Ciolek for reporting this issue.

Fixes CVE-2025-61724
Fixes #75716

Change-Id: I1a98ce85a21b830cb25799f9ac9333a67400d736
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/2940
Reviewed-by: Roland Shoemaker <bracewell@google.com>
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/709859
TryBot-Bypass: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
src/net/textproto/reader.go