7b10101b6f
Fix for 2.21 and 2.22: CVE-2015-7547 - glibc getaddrinfo stack-based buffer overflow. For 2.21: CVE-2014-8121 - Unexpected closing of nss_files databases after lookups causes denial of service. CVE-2015-1781 - buffer overflow in gethostbyname_r() and related functions with misaligned buffer. Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
33 lines
1.1 KiB
Diff
33 lines
1.1 KiB
Diff
From 10c6d2e3243cefdd22933d3706f53d9f913c6cab Mon Sep 17 00:00:00 2001
|
|
From: Arjun Shankar <arjun.is@lostca.se>
|
|
Date: Tue, 21 Apr 2015 14:06:31 +0200
|
|
Subject: [PATCH] CVE-2015-1781: resolv/nss_dns/dns-host.c buffer overflow
|
|
[BZ#18287]
|
|
|
|
Fixes:
|
|
CVE-2015-1781 - buffer overflow in gethostbyname_r() and related
|
|
functions with misaligned buffer.
|
|
|
|
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
|
|
---
|
|
resolv/nss_dns/dns-host.c | 3 ++-
|
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
|
|
index f715ab0..40069a7 100644
|
|
--- a/resolv/nss_dns/dns-host.c
|
|
+++ b/resolv/nss_dns/dns-host.c
|
|
@@ -615,7 +615,8 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
|
|
int have_to_map = 0;
|
|
uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct host_data);
|
|
buffer += pad;
|
|
- if (__glibc_unlikely (buflen < sizeof (struct host_data) + pad))
|
|
+ buflen = buflen > pad ? buflen - pad : 0;
|
|
+ if (__glibc_unlikely (buflen < sizeof (struct host_data)))
|
|
{
|
|
/* The buffer is too small. */
|
|
too_small:
|
|
--
|
|
2.4.4
|
|
|