mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-01 20:10:28 +00:00
LibCore: Fix a crash in CArgsParser
This commit is contained in:
parent
bec646c0bb
commit
e0e1be8c33
Notes:
sideshowbarker
2024-07-19 12:39:05 +09:00
Author: https://github.com/bugaevc Commit: https://github.com/SerenityOS/serenity/commit/e0e1be8c330 Pull-request: https://github.com/SerenityOS/serenity/pull/456 Reviewed-by: https://github.com/awesomekling ✅
1 changed files with 2 additions and 1 deletions
|
@ -108,7 +108,8 @@ int CArgsParser::parse_next_param(int index, char** argv, const int params_left,
|
|||
|
||||
bool CArgsParser::is_param_valid(const String& param_name)
|
||||
{
|
||||
return param_name.substring(0, m_prefix.length()) == m_prefix;
|
||||
return param_name.length() >= m_prefix.length() &&
|
||||
param_name.substring(0, m_prefix.length()) == m_prefix;
|
||||
}
|
||||
|
||||
bool CArgsParser::check_required_args(const CArgsParserResult& res)
|
||||
|
|
Loading…
Reference in a new issue