]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.23] net/http: reject newlines in chunk-size lines
authorDamien Neil <dneil@google.com>
Wed, 26 Feb 2025 21:40:00 +0000 (13:40 -0800)
committerCherry Mui <cherryyz@google.com>
Mon, 17 Mar 2025 21:51:53 +0000 (14:51 -0700)
commit15e01a2e43ecb8c7e15ff7e9d62fe3f10dcac931
tree79bcb644b86e235ab45ceef5dcb61f74a465bf81
parent45aade7f1edd77409b967dafc58dc537f5ac34f6
[release-branch.go1.23] net/http: reject newlines in chunk-size lines

Unlike request headers, where we are allowed to leniently accept
a bare LF in place of a CRLF, chunked bodies must always use CRLF
line terminators. We were already enforcing this for chunk-data lines;
do so for chunk-size lines as well. Also reject bare CRs anywhere
other than as part of the CRLF terminator.

Fixes CVE-2025-22871
Fixes #72010
For #71988

Change-Id: Ib0e21af5a8ba28c2a1ca52b72af8e2265ec79e4a
Reviewed-on: https://go-review.googlesource.com/c/go/+/652998
Reviewed-by: Jonathan Amsterdam <jba@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
(cherry picked from commit d31c805535f3fde95646ee4d87636aaaea66847b)
Reviewed-on: https://go-review.googlesource.com/c/go/+/657216
src/net/http/internal/chunked.go
src/net/http/internal/chunked_test.go
src/net/http/serve_test.go