ladybird/Userland/Libraries/LibHTTP
Karol Kosek 71f663b205 LibHTTP: Fix buffer overflow when body is larger than the Content-Length
(Actually, this also needs a Content-Encoding header, as response
streaming is disabled then. It didn't fit in the title.)

We were creating too small buffer -- instead of assigning the total
received buffer size, we were using the Content-Length value.

As you can see, the m_buffered_size might now exceed the Content-Length
value, but that will be handled in next commits, regardless if
the response can be streamed or not. :^)

Here's a minimal code that caused crash before:

  printf 'HTTP/1.0 200 OK\r\n%s\r\n%s\r\n\r\n%s' \
      'Content-Encoding: anything' 'Content-Length: 3' \
      ':^)AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' | nc -lN 0.0.0.0 8000
  pro http://0.0.0.0:8000
2021-10-24 23:54:26 +02:00
..
CMakeLists.txt LibCore+LibHTTP+LibGfx: Switch to LibCompress 2021-03-03 23:42:32 +01:00
Forward.h Everywhere: Use "the SerenityOS developers." in copyright headers 2021-04-29 00:59:26 +02:00
HttpJob.cpp LibHTTP+LibGemini: Set underlying sockets as idle when detaching 2021-10-04 15:31:26 +02:00
HttpJob.h LibHTTP: Respect the 'Connection: close' header on keep-alive jobs 2021-09-30 11:46:37 +02:00
HttpRequest.cpp AK+Everywhere: Make Base64 decoding fallible 2021-10-23 19:16:40 +01:00
HttpRequest.h Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safe 2021-09-06 01:53:26 +02:00
HttpResponse.cpp LibHTTP: Implement getting the correct reason phrase from HttpResponse 2021-06-11 11:37:15 +02:00
HttpResponse.h LibHTTP: Implement getting the correct reason phrase from HttpResponse 2021-06-11 11:37:15 +02:00
HttpsJob.cpp LibHTTP+LibGemini: Set underlying sockets as idle when detaching 2021-10-04 15:31:26 +02:00
HttpsJob.h LibHTTP: Respect the 'Connection: close' header on keep-alive jobs 2021-09-30 11:46:37 +02:00
Job.cpp LibHTTP: Fix buffer overflow when body is larger than the Content-Length 2021-10-24 23:54:26 +02:00
Job.h LibHTTP: Respect the 'Connection: close' header on keep-alive jobs 2021-09-30 11:46:37 +02:00