mirror of
git://git.musl-libc.org/musl
synced 2025-03-11 06:07:29 +00:00
fix bug where read error was treated as success reading library headers
This commit is contained in:
parent
d0c6cb05e7
commit
c4f49a6a72
@ -318,7 +318,7 @@ static void *map_library(int fd, struct dso *dso)
|
|||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
ssize_t l = read(fd, buf, sizeof buf);
|
ssize_t l = read(fd, buf, sizeof buf);
|
||||||
if (l<sizeof *eh) return 0;
|
if (l<(int)sizeof *eh) return 0;
|
||||||
eh = buf;
|
eh = buf;
|
||||||
phsize = eh->e_phentsize * eh->e_phnum;
|
phsize = eh->e_phentsize * eh->e_phnum;
|
||||||
if (phsize + sizeof *eh > l) return 0;
|
if (phsize + sizeof *eh > l) return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user