]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.25] 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:02:09 +0000 (11:02 -0700)
commit5d7a787aa2b486f77537eeaed9c38c940a7182b8
tree79882af1002562329bed66ff541797e437ae8e8c
parent930ce220d052d632f0d84df5850c812a77b70175
[release-branch.go1.25] 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 #75718

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/+/2960
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/709846
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