109-CVE-2018-1000005.patch 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. From fa3dbb9a147488a2943bda809c66fc497efe06cb Mon Sep 17 00:00:00 2001
  2. From: Zhouyihai Ding <ddyihai@ddyihai.svl.corp.google.com>
  3. Date: Wed, 10 Jan 2018 10:12:18 -0800
  4. Subject: [PATCH] http2: fix incorrect trailer buffer size
  5. Prior to this change the stored byte count of each trailer was
  6. miscalculated and 1 less than required. It appears any trailer
  7. after the first that was passed to Curl_client_write would be truncated
  8. or corrupted as well as the size. Potentially the size of some
  9. subsequent trailer could be erroneously extracted from the contents of
  10. that trailer, and since that size is used by client write an
  11. out-of-bounds read could occur and cause a crash or be otherwise
  12. processed by client write.
  13. The bug appears to have been born in 0761a51 (precedes 7.49.0).
  14. Closes https://github.com/curl/curl/pull/2231
  15. ---
  16. lib/http2.c | 4 ++--
  17. 1 file changed, 2 insertions(+), 2 deletions(-)
  18. --- a/lib/http2.c
  19. +++ b/lib/http2.c
  20. @@ -864,8 +864,8 @@ static int on_header(nghttp2_session *se
  21. if(stream->bodystarted) {
  22. /* This is trailer fields. */
  23. - /* 3 is for ":" and "\r\n". */
  24. - uint32_t n = (uint32_t)(namelen + valuelen + 3);
  25. + /* 4 is for ": " and "\r\n". */
  26. + uint32_t n = (uint32_t)(namelen + valuelen + 4);
  27. DEBUGF(infof(data_s, "h2 trailer: %.*s: %.*s\n", namelen, name, valuelen,
  28. value));