aboutsummaryrefslogtreecommitdiff
path: root/linux-user/elfload.c
diff options
context:
space:
mode:
authorj_mayer <j_mayer@c046a42c-6fe2-441c-8c8c-71466251a162>2007-09-27 04:10:43 +0000
committerj_mayer <j_mayer@c046a42c-6fe2-441c-8c8c-71466251a162>2007-09-27 04:10:43 +0000
commit4118a97030aa9bd1d520d1d06bbe0655d829df04 (patch)
treeb963cf2e91c23b60aad7c70fc5423114f274434b /linux-user/elfload.c
parent526216880d5c4cb2507bdb22d6a5d33016f38104 (diff)
memset string pages to zero to avoid putting random data on the stack
that may make some program crash at startup. Fix unsigned long / target_ulong confusion (more to do). Fix missing g2h macros. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3249 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'linux-user/elfload.c')
-rw-r--r--linux-user/elfload.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 2a43338125..22e3283ae7 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -517,7 +517,7 @@ static void bswap_sym(struct elf_sym *sym)
*
*/
static unsigned long copy_elf_strings(int argc,char ** argv, void **page,
- unsigned long p)
+ target_ulong p)
{
char *tmp, *tmp1, *pag = NULL;
int len, offset = 0;
@@ -544,6 +544,7 @@ static unsigned long copy_elf_strings(int argc,char ** argv, void **page,
pag = (char *)page[p/TARGET_PAGE_SIZE];
if (!pag) {
pag = (char *)malloc(TARGET_PAGE_SIZE);
+ memset(pag, 0, TARGET_PAGE_SIZE);
page[p/TARGET_PAGE_SIZE] = pag;
if (!pag)
return 0;