libdrgn: dwarf_index: fix DW_AT_strp bounds check

The string must be null terminated, so there must be at least one byte
left in .debug_str.

Signed-off-by: Omar Sandoval <osandov@osandov.com>
This commit is contained in:
Omar Sandoval 2021-06-25 17:45:12 -07:00
parent c4b174af74
commit 420d2bb1dc

View File

@ -1461,7 +1461,7 @@ sibling:
if ((err = binary_buffer_next_u64(&buffer->bb, &tmp)))
return err;
strp:
if (tmp > debug_str->d_size) {
if (tmp >= debug_str->d_size) {
return binary_buffer_error(&buffer->bb,
"DW_AT_name is out of bounds");
}