diff options
| author | Christos Zoulas <christos@zoulas.com> | 2004-07-24 20:57:22 +0000 |
|---|---|---|
| committer | Christos Zoulas <christos@zoulas.com> | 2004-07-24 20:57:22 +0000 |
| commit | 0db1c22a29a08cd098f94eefef599af58048293f (patch) | |
| tree | a4de00c9a42fe6beface4ea27df00060b08d18a8 | |
| parent | 870c1892bd1a8d69e08296c237d08ec99e3ce083 (diff) | |
| download | file-git-0db1c22a29a08cd098f94eefef599af58048293f.tar.gz | |
we don't just read the header size, but the whole note too; so revert the
previous buffer fix.
| -rw-r--r-- | src/readelf.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/readelf.c b/src/readelf.c index ec63a5ea..ccfa491a 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -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 @@ -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) @@ -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; @@ -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; |
