Skip to content

Commit

Permalink
we don't just read the header size, but the whole note too; so revert…
Browse files Browse the repository at this point in the history
… the

previous buffer fix.
  • Loading branch information
zoulasc committed Jul 24, 2004
1 parent 870c189 commit 0db1c22
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/readelf.c
Expand Up @@ -39,7 +39,7 @@
#include "readelf.h"

#ifndef lint
FILE_RCSID("@(#)$Id: readelf.c,v 1.41 2004/07/24 20:38:56 christos Exp $")
FILE_RCSID("@(#)$Id: readelf.c,v 1.42 2004/07/24 20:57:22 christos Exp $")
#endif

#ifdef ELFCORE
Expand Down Expand Up @@ -150,6 +150,9 @@ getu64(int swap, uint64_t value)
#define ph_filesz (size_t)((class == ELFCLASS32 \
? getu32(swap, ph32.p_filesz) \
: getu64(swap, ph64.p_filesz)))
#define ph_memsz (size_t)((class == ELFCLASS32 \
? getu32(swap, ph32.p_memsz) \
: getu64(swap, ph64.p_memsz)))
#define nh_size (class == ELFCLASS32 \
? sizeof nh32 \
: sizeof nh64)
Expand Down Expand Up @@ -253,8 +256,7 @@ dophn_core(struct magic_set *ms, int class, int swap, int fd, off_t off,
file_badseek(ms);
return -1;
}
bufsize = read(fd, nbuf,
((ph_filesz < BUFSIZ) ? ph_filesz : BUFSIZ));
bufsize = read(fd, nbuf, sizeof(nbuf));
if (bufsize == -1) {
file_badread(ms);
return -1;
Expand Down Expand Up @@ -691,9 +693,7 @@ dophn_exec(struct magic_set *ms, int class, int swap, int fd, off_t off,
file_badseek(ms);
return -1;
}
bufsize = read(fd, nbuf,
((ph_filesz < sizeof(nbuf)) ?
ph_filesz : sizeof(nbuf)));
bufsize = read(fd, nbuf, sizeof(nbuf));
if (bufsize == -1) {
file_badread(ms);
return -1;
Expand Down

0 comments on commit 0db1c22

Please sign in to comment.