From a0582c5380ed8adeb3ff82e883b634f904b7eee5 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Tue, 27 Sep 2016 20:19:43 +0200 Subject: [PATCH] pefile.cpp: don't use VLA. --- src/pefile.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pefile.cpp b/src/pefile.cpp index 91fccbc5..f15ab3b2 100644 --- a/src/pefile.cpp +++ b/src/pefile.cpp @@ -2272,7 +2272,8 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh, identsize += ic; const unsigned oobjs = last_section_rsrc_only ? 4 : 3; - pe_section_t osection[oobjs]; + ////pe_section_t osection[oobjs]; + pe_section_t osection[4]; // section 0 : bss // 1 : [ident + header] + packed_data + unpacker + tls + loadconf // 2 : not compressed data @@ -2466,7 +2467,7 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh, // write loader + compressed file fo->write(&oh,sizeof(oh)); - fo->write(osection,sizeof(osection)); + fo->write(osection,sizeof(osection[0])*oobjs); // some alignment if (identsplit == identsize) { @@ -2509,7 +2510,7 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh, #if 0 printf("%-13s: program hdr : %8ld bytes\n", getName(), (long) sizeof(oh)); - printf("%-13s: sections : %8ld bytes\n", getName(), (long) sizeof(osection)); + printf("%-13s: sections : %8ld bytes\n", getName(), (long) sizeof(osection[0])*oobjs); printf("%-13s: ident : %8ld bytes\n", getName(), (long) identsize); printf("%-13s: compressed : %8ld bytes\n", getName(), (long) c_len); printf("%-13s: decompressor : %8ld bytes\n", getName(), (long) codesize);