Skip to content

Commit

Permalink
libdpe: make the initial read buffer always big enough for the opt he…
Browse files Browse the repository at this point in the history
…ader

Signed-off-by: Peter Jones <[email protected]>
  • Loading branch information
vathpela committed Nov 8, 2021
1 parent 3d05219 commit d71dd4c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libdpe/pe_begin.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,14 @@ read_unmmapped_file(int fildes, size_t maxsize, Pe_Cmd cmd, Pe *parent)
struct {
struct mz_hdr mz;
struct pe_hdr pe;
union {
struct pe32_opt_hdr opt_hdr_32;
struct pe32plus_opt_hdr opt_hdr_64;
};
};
unsigned char raw[1];
unsigned char raw[sizeof(struct mz_hdr)
+ sizeof(struct pe_hdr)
+ sizeof(struct pe32plus_opt_hdr)];
} mem;

ssize_t nread = pread_retry (fildes, &mem.mz, sizeof(mem.mz), 0);
Expand Down

0 comments on commit d71dd4c

Please sign in to comment.