From f78e9261f3c859b80a22330d2f2eada5bb7446c3 Mon Sep 17 00:00:00 2001 From: John Reiser Date: Thu, 10 Nov 2005 04:45:22 +0000 Subject: [PATCH] Do initLoader() properly, instead of relying on the amount of stack space that is in use when ::buildLinuxLoader is called. committer: jreiser 1131597922 +0000 --- src/p_lx_elf.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index bda0f78f..b6bf950b 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -273,8 +273,13 @@ PackLinuxElf32ppc::buildLinuxLoader( Filter const */*ft*/ ) { - int eof_empty = -1; - initLoader(&eof_empty, 4096, 0, 0); + { + int const MAX_LOADER_LEN = 4096; + int *const eof_empty = new int[MAX_LOADER_LEN/sizeof(int)]; + eof_empty[0] = -1; + initLoader(eof_empty, MAX_LOADER_LEN, 0, 0); + delete[] eof_empty; + } struct b_info h; memset(&h, 0, sizeof(h)); unsigned fold_hdrlen = 0; @@ -325,8 +330,13 @@ PackLinuxElf64amd::buildLinuxLoader( Filter const */*ft*/ ) { - int eof_empty = -1; - initLoader(&eof_empty, 9000, 0, 0); + { + int const MAX_LOADER_LEN = 8000; + int *const eof_empty = new int[MAX_LOADER_LEN/sizeof(int)]; + eof_empty[0] = -1; + initLoader(eof_empty, MAX_LOADER_LEN, 0, 0); + delete[] eof_empty; + } struct b_info h; memset(&h, 0, sizeof(h)); unsigned fold_hdrlen = 0;