Skip to content

Commit 30551d7

Browse files
committed
Fix 32-bit ELF dynamic section parsing
Use Elf32_Dyn instead of Elf64_Dyn when parsing PT_DYNAMIC segments in 32-bit ELF files. The incorrect type could cause a segfault on special 32 bit libraries. Fixes: https://issues.redhat.com/browse/RHEL-1357 Signed-off-by: Petr Lautrbach <lautrbach@redhat.com>
1 parent b91b460 commit 30551d7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/library/file.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,7 +1485,7 @@ uint32_t gather_elf(int fd, off_t size)
14851485
if (ph_tbl[i].p_filesz > size)
14861486
goto err_out32;
14871487

1488-
Elf64_Dyn *dyn_tbl = malloc(ph_tbl[i].p_filesz);
1488+
Elf32_Dyn *dyn_tbl = malloc(ph_tbl[i].p_filesz);
14891489

14901490
if((unsigned int)lseek(fd, ph_tbl[i].p_offset,
14911491
SEEK_SET) !=
@@ -1494,7 +1494,7 @@ uint32_t gather_elf(int fd, off_t size)
14941494
goto err_out32;
14951495
}
14961496

1497-
num = ph_tbl[i].p_filesz / sizeof(Elf64_Dyn);
1497+
num = ph_tbl[i].p_filesz / sizeof(Elf32_Dyn);
14981498
if (num > 1000) {
14991499
free(dyn_tbl);
15001500
goto err_out32;

0 commit comments

Comments
 (0)