diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2021-04-28 21:05:35 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-28 22:14:32 +0200 |
commit | d9f7b29273330af742abb8476e1a14fd9963c97a (patch) | |
tree | b855bc881cb5f8424b06c4afded7c892a90dcebc /Kernel | |
parent | c9f3cc6dcc5bcc55d3126c601312e9bea78782a1 (diff) | |
download | serenity-d9f7b29273330af742abb8476e1a14fd9963c97a.zip |
Kernel: Check kernel symbol's name length matches searched name
The current implementation would only check the first name.length()
characters match, which means any kernel symbol that the provided name
is a prefix of would match, instead of the actual matching symbol.
This commit fixes that by using StringView::operator==() for the
comparison, which already checks the equality correctly.
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/KSyms.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Kernel/KSyms.cpp b/Kernel/KSyms.cpp index 2edc517973..8a21a9e661 100644 --- a/Kernel/KSyms.cpp +++ b/Kernel/KSyms.cpp @@ -32,8 +32,9 @@ static u8 parse_hex_digit(char nibble) FlatPtr address_for_kernel_symbol(const StringView& name) { for (size_t i = 0; i < s_symbol_count; ++i) { - if (!strncmp(name.characters_without_null_termination(), s_symbols[i].name, name.length())) - return s_symbols[i].address; + const auto& symbol = s_symbols[i]; + if (name == symbol.name) + return symbol.address; } return 0; } |