summaryrefslogtreecommitdiffstats
path: root/libdw/dwarf_getalt.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2018-06-05 21:29:27 +0200
committerMark Wielaard <[email protected]>2018-06-08 12:03:14 +0200
commit0393dccf9a346c9ecd8753bcbe0b31f8a1edbe5b (patch)
tree854b715249c762f55ef9982805bd7a7597b767f8 /libdw/dwarf_getalt.c
parent8e2728833042eb4e01e52284a764b122920ca9cc (diff)
libdw: Make sure id_path can contain max number of build id bytes.
The MAX_BUILD_ID_BYTES is fairly large (64), while normally build-ids are only 20 bytes long. But if we would encounter a jumbo build-id we should have enough room to construct the full build-id path. We used to substract 2 bytes from the max, because 2 chars are used as subdir. But that should be 1 (2 hex chars is just one 8 bit byte). Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'libdw/dwarf_getalt.c')
-rw-r--r--libdw/dwarf_getalt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libdw/dwarf_getalt.c b/libdw/dwarf_getalt.c
index 3339b3e1..0a12dfae 100644
--- a/libdw/dwarf_getalt.c
+++ b/libdw/dwarf_getalt.c
@@ -123,7 +123,7 @@ find_debug_altlink (Dwarf *dbg)
{
/* Note sizeof a string literal includes the trailing zero. */
char id_path[sizeof DEBUGINFO_PATH - 1 + sizeof "/.build-id/" - 1
- + 2 + 1 + (MAX_BUILD_ID_BYTES - 2) * 2 + sizeof ".debug"];
+ + 2 + 1 + (MAX_BUILD_ID_BYTES - 1) * 2 + sizeof ".debug"];
sprintf (&id_path[0], "%s%s", DEBUGINFO_PATH, "/.build-id/");
sprintf (&id_path[sizeof DEBUGINFO_PATH - 1 + sizeof "/.build-id/" - 1],
"%02" PRIx8 "/", (uint8_t) id[0]);