]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.24] 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 18:00:38 +0000 (11:00 -0700)
commita402f4ad285514f5f3db90516d72047d591b307a
tree12ce5f8f46b3fd99b6e594f5b3f77186f95325a8
parentf9f198ab05e3282cbf6b13251d47d9141981e401
[release-branch.go1.24] 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
For #75716
Fixes #75717

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-internal-review.googlesource.com/c/go/+/2980
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/709837
Reviewed-by: Carlos Amedee <carlos@golang.org>
TryBot-Bypass: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
src/net/textproto/reader.go