mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
Everywhere: Explicitly specify the size in StringView constructors
This commit moves the length calculations out to be directly on the StringView users. This is an important step towards the goal of removing StringView(char const*), as it moves the responsibility of calculating the size of the string to the user of the StringView (which will prevent naive uses causing OOB access).
This commit is contained in:
@@ -336,7 +336,8 @@ auto DynamicObject::HashSection::lookup_gnu_symbol(StringView name, u32 hash_val
|
||||
|
||||
StringView DynamicObject::symbol_string_table_string(ElfW(Word) index) const
|
||||
{
|
||||
return StringView { (char const*)base_address().offset(m_string_table_offset + index).as_ptr() };
|
||||
auto const* symbol_string_table_ptr = reinterpret_cast<char const*>(base_address().offset(m_string_table_offset + index).as_ptr());
|
||||
return StringView { symbol_string_table_ptr, strlen(symbol_string_table_ptr) };
|
||||
}
|
||||
|
||||
char const* DynamicObject::raw_symbol_string_table_string(ElfW(Word) index) const
|
||||
|
||||
Reference in New Issue
Block a user