Commit ce53f7c2 authored by Guillem Jover's avatar Guillem Jover

nlist: Fix pread() return value check

We should check for partial reads, and not continue in those cases,
as we are not retrying them, otherwise we might end up operating on
uninitialized data.
Reported-by: 's avatarDaniel Hodson <daniel@elttam.com.au>
Based-on-patch-by: 's avatarDaniel Hodson <daniel@elttam.com.au>
Signed-off-by: Guillem Jover's avatarGuillem Jover <guillem@hadrons.org>
parent 24d1f4dd
......@@ -161,7 +161,7 @@ __fdnlist(int fd, struct nlist *list)
return (-1);
/* Load section header table. */
if (pread(fd, shdr, (size_t)shdr_size, (off_t)ehdr.e_shoff) < 0)
if (pread(fd, shdr, (size_t)shdr_size, (off_t)ehdr.e_shoff) != (ssize_t)shdr_size)
goto done;
/*
......@@ -198,7 +198,7 @@ __fdnlist(int fd, struct nlist *list)
if (strtab == NULL)
goto done;
if (pread(fd, strtab, (size_t)symstrsize, (off_t)symstroff) < 0)
if (pread(fd, strtab, (size_t)symstrsize, (off_t)symstroff) != (ssize_t)symstrsize)
goto done;
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment