From 7852b0fbc3f0e08528e4f4c8e82a891bbc1c353d Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Sun, 12 Sep 2021 21:12:21 -0700 Subject: [PATCH] LibWeb: Identical sub-expression bug in URLSearchParams::set Flagged by sonarcloud, we appear to want to make sure the entry.name matches the name we are searching for duplicates of. Link: https://sonarcloud.io/project/issues?fileUuids=AXvdC606QRvsO1F91p5C&id=SerenityOS_serenity&open=AXvdC_NEQRvsO1F91p6j --- Userland/Libraries/LibWeb/URL/URLSearchParams.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/URL/URLSearchParams.cpp b/Userland/Libraries/LibWeb/URL/URLSearchParams.cpp index 2872471069..2849427e87 100644 --- a/Userland/Libraries/LibWeb/URL/URLSearchParams.cpp +++ b/Userland/Libraries/LibWeb/URL/URLSearchParams.cpp @@ -88,7 +88,7 @@ void URLSearchParams::set(const String& name, const String& value) if (!existing.is_end()) { existing->value = value; m_list.remove_all_matching([&name, &existing](auto& entry) { - return &entry != &*existing && name == name; + return &entry != &*existing && entry.name == name; }); } // 2. Otherwise, append a new name-value pair whose name is name and value is value, to this’s list.