Преглед на файлове

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
Brian Gianforcaro преди 3 години
родител
ревизия
7852b0fbc3
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      Userland/Libraries/LibWeb/URL/URLSearchParams.cpp

+ 1 - 1
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.