mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-27 21:21:50 +03:00
Kernel: Check only for the first equal sign in the kernel command line
... key-value decomposition The RaspberryPi firmware will give us a value for the 'video' key that contains multiple equal signs: ``` video=HDMI-A-1:1920x1080M@30D,margin_left=48,margin_right=48,[...] ``` Instead of asserting that this only has one equal sign, let's just split it by the first one.
This commit is contained in:
parent
fcbb8d63c0
commit
60cddb4179
Notes:
sideshowbarker
2024-07-18 05:01:22 +09:00
Author: https://github.com/Hendiadyoin1 Commit: https://github.com/SerenityOS/serenity/commit/60cddb4179 Pull-request: https://github.com/SerenityOS/serenity/pull/18874 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/BertalanD ✅
@ -58,15 +58,13 @@ UNMAP_AFTER_INIT void CommandLine::add_arguments(Vector<StringView> const& args)
|
||||
if (str == ""sv) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto pair = str.split_view('=');
|
||||
VERIFY(pair.size() == 2 || pair.size() == 1);
|
||||
|
||||
if (pair.size() == 1) {
|
||||
m_params.set(pair[0], ""sv);
|
||||
} else {
|
||||
m_params.set(pair[0], pair[1]);
|
||||
}
|
||||
// Some boot loaders may include complex key-value pairs where the value is a composite entry,
|
||||
// we handle this by only checking for the first equals sign in each command line parameter.
|
||||
auto key = str.find_first_split_view('=');
|
||||
if (key.length() == str.length())
|
||||
m_params.set(key, ""sv);
|
||||
else
|
||||
m_params.set(key, str.substring_view(key.length() + 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user