title: Memory exhaustion in multipart form parsing in net/textproto and net/http
description: When parsing a multipart form (either explicitly with Request.ParseMultipartForm or implicitly with Request.FormValue, Request.PostFormValue, or Request.FormFile), limits on the total size of the parsed form were not applied to the memory consumed while reading a single form line. This permits a maliciously crafted input containing very long lines to cause allocation of arbitrarily large amounts of memory, potentially leading to memory exhaustion. With fix, the ParseMultipartForm function now correctly limits the maximum size of form lines.
problem types: CWE-400: Uncontrolled Resource Consumption
affected:
{
vendor: Go standard library
product: net/textproto
collectionURL: https://pkg.go.dev
packageName: net/textproto
versions:
version: 0, lessThan: 1.21.8, status: affected, versionType: semver
version: 1.22.0-0, lessThan: 1.22.1, status: affected, versionType: semver
programRoutines:
name: Reader.readLineSlice
name: Reader.readContinuedLineSlice
name: Reader.ReadCodeLine
name: Reader.ReadContinuedLine
name: Reader.ReadContinuedLineBytes
name: Reader.ReadDotLines
name: Reader.ReadLine
name: Reader.ReadLineBytes
name: Reader.ReadMIMEHeader
name: Reader.ReadResponse
defaultStatus: unaffected
}