mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 21:59:07 +00:00
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.
This commit is contained in:
parent
c9f3cc6dcc
commit
d9f7b29273
Notes:
sideshowbarker
2024-07-18 19:00:05 +09:00
Author: https://github.com/IdanHo
Commit: d9f7b29273
Pull-request: https://github.com/SerenityOS/serenity/pull/6712
Reviewed-by: https://github.com/awesomekling
1 changed files with 3 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue