summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2024-08-28 23:43:02 +0200
committerMark Wielaard <[email protected]>2024-09-11 17:02:45 +0200
commit41022b0bfd934b37cdf9572d27048263b118f252 (patch)
tree17245fffa9bf9b1430a80a01507159abfa1595f3
parent90973df78628a5aefa973d676a4402285e93c9cf (diff)
elf*_xlatetof: do not check ELF_T_NHDR[8] has integer number of records
commit bc0f7450c "elf*_xlatetom: do not check ELF_T_NHDR has integer number of records" fixed https://bugzilla.redhat.com/show_bug.cgi?id=835877 But only for xlatetom. Do the same for xlatetof. * elf32_xlatetof.c (elfw2(LIBELFBITS, xlatetof)): Do not check for integer number of records in case of ELF_T_NHDR[8]. Signed-off-by: Mark Wielaard <[email protected]>
-rw-r--r--libelf/elf32_xlatetof.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libelf/elf32_xlatetof.c b/libelf/elf32_xlatetof.c
index ab857409..ab3e609e 100644
--- a/libelf/elf32_xlatetof.c
+++ b/libelf/elf32_xlatetof.c
@@ -51,7 +51,11 @@ elfw2(LIBELFBITS, xlatetof) (Elf_Data *dest, const Elf_Data *src,
data types are identical. */
size_t recsize = __libelf_type_sizes[ELFW(ELFCLASS,LIBELFBITS) - 1][src->d_type];
- if (src->d_size % recsize != 0)
+ /* We shouldn't require integer number of records when processing
+ notes. Payload bytes follow the header immediately, it's not an
+ array of records as is the case otherwise. */
+ if (src->d_type != ELF_T_NHDR && src->d_type != ELF_T_NHDR8
+ && src->d_size % recsize != 0)
{
__libelf_seterrno (ELF_E_INVALID_DATA);
return NULL;