diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2021-09-06 03:29:52 +0430 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-06 01:53:26 +0200 |
commit | 97e97bccab085823d1365cb54142fd8c41dbcd8c (patch) | |
tree | 9008687dbcdfb6f36f6dc6372aa382b15b9d36c8 /Userland/Libraries/LibProtocol/RequestClient.cpp | |
parent | 3a9f00c59bad7735970c72cb940d08161fda09b0 (diff) | |
download | serenity-97e97bccab085823d1365cb54142fd8c41dbcd8c.zip |
Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safe
Diffstat (limited to 'Userland/Libraries/LibProtocol/RequestClient.cpp')
-rw-r--r-- | Userland/Libraries/LibProtocol/RequestClient.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Userland/Libraries/LibProtocol/RequestClient.cpp b/Userland/Libraries/LibProtocol/RequestClient.cpp index 613c262223..00a3f57c58 100644 --- a/Userland/Libraries/LibProtocol/RequestClient.cpp +++ b/Userland/Libraries/LibProtocol/RequestClient.cpp @@ -22,7 +22,11 @@ RefPtr<Request> RequestClient::start_request(String const& method, URL const& ur for (auto& it : request_headers) header_dictionary.add(it.key, it.value); - auto response = IPCProxy::start_request(method, url, header_dictionary, ByteBuffer::copy(request_body)); + auto body_result = ByteBuffer::copy(request_body); + if (!body_result.has_value()) + return nullptr; + + auto response = IPCProxy::start_request(method, url, header_dictionary, body_result.release_value()); auto request_id = response.request_id(); if (request_id < 0 || !response.response_fd().has_value()) return nullptr; |