aboutsummaryrefslogtreecommitdiffstats
path: root/main/musl/0020-in-static-dl_iterate_phdr-fix-use-of-possibly-uninit.patch
blob: 0dd2d6f8b6f1d1199206b65b146cddec4f66a41e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
From 500f5bee6c03981961f1586fca2a1dee6fdce7c7 Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
Date: Tue, 14 Mar 2017 14:29:50 -0400
Subject: [PATCH] in static dl_iterate_phdr, fix use of possibly-uninitialized
 aux data

this could only happen if an incomplete auxv was passed into the
program, but it's better to just initialize the data anyway.
---
 src/ldso/dl_iterate_phdr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ldso/dl_iterate_phdr.c b/src/ldso/dl_iterate_phdr.c
index c141fd9b..e55cbf76 100644
--- a/src/ldso/dl_iterate_phdr.c
+++ b/src/ldso/dl_iterate_phdr.c
@@ -11,7 +11,7 @@ static int static_dl_iterate_phdr(int(*callback)(struct dl_phdr_info *info, size
 	size_t base = 0;
 	size_t n;
 	struct dl_phdr_info info;
-	size_t i, aux[AUX_CNT];
+	size_t i, aux[AUX_CNT] = {0};
 
 	for (i=0; libc.auxv[i]; i+=2)
 		if (libc.auxv[i]<AUX_CNT) aux[libc.auxv[i]] = libc.auxv[i+1];
-- 
2.11.1