mirror of
https://github.com/RGBCube/serenity
synced 2025-07-02 23:12:08 +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:
parent
e3da0adfe6
commit
c70f45ff44
75 changed files with 264 additions and 203 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue