mirror of
https://github.com/serge1/ELFIO.git
synced 2024-12-28 06:15:21 +00:00
Validate that strings in table are null terminated
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
This commit is contained in:
parent
2879ee62a2
commit
f1c7d420e4
@ -46,6 +46,10 @@ template <class S> class string_section_accessor_template
|
|||||||
if ( index < string_section->get_size() ) {
|
if ( index < string_section->get_size() ) {
|
||||||
const char* data = string_section->get_data();
|
const char* data = string_section->get_data();
|
||||||
if ( nullptr != data ) {
|
if ( nullptr != data ) {
|
||||||
|
size_t string_length = strnlen(
|
||||||
|
data + index, string_section->get_size() - index );
|
||||||
|
if ( string_length <
|
||||||
|
( string_section->get_size() - index ) )
|
||||||
return data + index;
|
return data + index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user