mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 11:36:10 +00:00
UI/Qt: Prevent UAF while parsing autocomplete response data
JsonParser only holds a view into the provided string, the caller must keep it alive. Though we can actually just use JsonValue::from_string here instead.
This commit is contained in:
parent
ea8213f7fa
commit
86a93b9b47
Notes:
github-actions[bot]
2025-03-20 09:51:49 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/86a93b9b476 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4008 Reviewed-by: https://github.com/gmta ✅
1 changed files with 2 additions and 3 deletions
|
@ -6,7 +6,6 @@
|
|||
|
||||
#include <AK/JsonArray.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/JsonParser.h>
|
||||
#include <LibURL/URL.h>
|
||||
#include <UI/Qt/AutoComplete.h>
|
||||
#include <UI/Qt/Settings.h>
|
||||
|
@ -111,8 +110,8 @@ ErrorOr<void> AutoComplete::got_network_response(QNetworkReply* reply)
|
|||
if (reply->error() == QNetworkReply::NetworkError::OperationCanceledError)
|
||||
return {};
|
||||
|
||||
AK::JsonParser parser(ak_byte_string_from_qstring(reply->readAll()));
|
||||
auto json = TRY(parser.parse());
|
||||
auto reply_data = ak_string_from_qstring(reply->readAll());
|
||||
auto json = TRY(JsonValue::from_string(reply_data));
|
||||
|
||||
auto engine_name = Settings::the()->autocomplete_engine().name;
|
||||
Vector<String> results;
|
||||
|
|
Loading…
Add table
Reference in a new issue