summaryrefslogtreecommitdiffstats
path: root/src/strip.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2021-06-18 15:06:32 +0200
committerMark Wielaard <[email protected]>2021-07-03 00:25:18 +0200
commitd3671293d7b86810a4a02de18ebea6d19ca82623 (patch)
treeb3cee5567de542f3233146807c85d970dc1eb50a /src/strip.c
parentc05ad596b5557a1776953be705a4bb66eee911fa (diff)
strip: Always check gelf_update results.
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'src/strip.c')
-rw-r--r--src/strip.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/strip.c b/src/strip.c
index 70fc8c03..961b9db5 100644
--- a/src/strip.c
+++ b/src/strip.c
@@ -705,17 +705,21 @@ remove_debug_relocations (Ebl *ebl, Elf *elf, GElf_Ehdr *ehdr,
relocate_failed:
if (relidx != next)
{
+ int updated;
if (is_rela)
- gelf_update_rela (reldata, next, rel_p);
+ updated = gelf_update_rela (reldata, next, rel_p);
else
- gelf_update_rel (reldata, next, rel_p);
+ updated = gelf_update_rel (reldata, next, rel_p);
+ if (updated == 0)
+ INTERNAL_ERROR (fname);
}
++next;
}
nrels = next;
shdr->sh_size = reldata->d_size = nrels * shdr->sh_entsize;
- gelf_update_shdr (scn, shdr);
+ if (gelf_update_shdr (scn, shdr) == 0)
+ INTERNAL_ERROR (fname);
if (is_gnu_compressed)
{
@@ -952,7 +956,8 @@ update_section_size (Elf_Scn *scn,
GElf_Shdr shdr_mem;
GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
shdr->sh_size = newdata->d_size;
- (void) gelf_update_shdr (scn, shdr);
+ if (gelf_update_shdr (scn, shdr) == 0)
+ INTERNAL_ERROR (fname);
if (debugelf != NULL)
{
/* libelf will use d_size to set sh_size. */