aboutsummaryrefslogtreecommitdiffstats
path: root/main/musl/0008-fix-uninitialized-scopeid-in-lookups-from-hosts-file.patch
blob: 5422e5a3aa610587876001a19aeea43cc5071981 (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
29
30
31
32
33
34
35
36
From cb1c88d42b0ee5e950d85e933c6eb6ecb8175e1d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Fri, 11 Sep 2015 06:15:06 +0000
Subject: [PATCH] fix uninitialized scopeid in lookups from hosts file and ip
 literals

---
 src/network/lookup_ipliteral.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/network/lookup_ipliteral.c b/src/network/lookup_ipliteral.c
index 7bcb85f..7ca70b2 100644
--- a/src/network/lookup_ipliteral.c
+++ b/src/network/lookup_ipliteral.c
@@ -24,7 +24,7 @@ int __lookup_ipliteral(struct address buf[static 1], const char *name, int famil
 	if (family != AF_INET) {
 		char tmp[64];
 		char *p = strchr(name, '%'), *z;
-		unsigned long long scopeid;
+		unsigned long long scopeid = 0;
 		if (p && p-name < 64) {
 			memcpy(tmp, name, p-name);
 			tmp[p-name] = 0;
@@ -44,8 +44,8 @@ int __lookup_ipliteral(struct address buf[static 1], const char *name, int famil
 				if (!scopeid) return EAI_NONAME;
 			}
 			if (scopeid > UINT_MAX) return EAI_NONAME;
-			buf[0].scopeid = scopeid;
 		}
+		buf[0].scopeid = scopeid;
 		return 1;
 	}
 	return 0;
-- 
2.5.1