From f4a9b09e6c13065077c7f297c88c934622e1d325 Mon Sep 17 00:00:00 2001 From: martin Date: Wed, 31 Aug 2016 16:22:37 +0000 Subject: [PATCH] Initialize the marker for the data segment, in case the caller passes not fully initialized markers to loadfile(). Pointed out by Mark Cave-Ayland. --- sys/lib/libsa/loadfile_elf32.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/lib/libsa/loadfile_elf32.c b/sys/lib/libsa/loadfile_elf32.c index c8d4a17d92e7..22e941726bd0 100644 --- a/sys/lib/libsa/loadfile_elf32.c +++ b/sys/lib/libsa/loadfile_elf32.c @@ -1,4 +1,4 @@ -/* $NetBSD: loadfile_elf32.c,v 1.31 2015/07/25 07:06:11 isaki Exp $ */ +/* $NetBSD: loadfile_elf32.c,v 1.32 2016/08/31 16:22:37 martin Exp $ */ /*- * Copyright (c) 1997, 2008 The NetBSD Foundation, Inc. @@ -279,6 +279,9 @@ ELFNAMEEND(loadfile)(int fd, Elf_Ehdr *elf, u_long *marks, int flags) /* some ports dont use the offset */ (void)&offset; + /* have not seen a data segment so far */ + marks[MARK_DATA] = 0; + internalize_ehdr(elf->e_ident[EI_DATA], elf); sz = elf->e_phnum * sizeof(Elf_Phdr);