]> git.ipfire.org Git - thirdparty/grub.git/commit
net/http: Error out on headers with LF without CR
authorDaniel Axtens <dja@axtens.net>
Tue, 8 Mar 2022 08:04:40 +0000 (19:04 +1100)
committerDaniel Kiper <daniel.kiper@oracle.com>
Tue, 7 Jun 2022 14:39:33 +0000 (16:39 +0200)
commitb26b4c08e7119281ff30d0fb4a6169bd2afa8fe4
tree23de7887aaae406c8275cce20c337a7bb396745d
parentec6bfd3237394c1c7dbf2fd73417173318d22f4b
net/http: Error out on headers with LF without CR

In a similar vein to the previous patch, parse_line() would write
a NUL byte past the end of the buffer if there was an HTTP header
with a LF rather than a CRLF.

RFC-2616 says:

  Many HTTP/1.1 header field values consist of words separated by LWS
  or special characters. These special characters MUST be in a quoted
  string to be used within a parameter value (as defined in section 3.6).

We don't support quoted sections or continuation lines, etc.

If we see an LF that's not part of a CRLF, bail out.

Fixes: CVE-2022-28734
Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/net/http.c