summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2015-12-17 16:08:28 +0000
committerume <ume@FreeBSD.org>2015-12-17 16:08:28 +0000
commit9e838a130f7515d8e377b7627d6a42db0e14158f (patch)
tree4259bec354a0bb4f9fc1497e401ec0e7bd1b0cd4 /lib
parent5952006acb1f0577732ac15f481976227292807f (diff)
downloadFreeBSD-src-9e838a130f7515d8e377b7627d6a42db0e14158f.zip
FreeBSD-src-9e838a130f7515d8e377b7627d6a42db0e14158f.tar.gz
MFC r292059:
The calls to RES_SET_H_ERRNO() macro on error paths wind up dereferencing an uninitialized res. PR: 202142 Submitted by: Sean Boudreau
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/net/getaddrinfo.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c
index b4c1a33..1651279 100644
--- a/lib/libc/net/getaddrinfo.c
+++ b/lib/libc/net/getaddrinfo.c
@@ -2207,6 +2207,8 @@ _dns_getaddrinfo(void *rv, void *cb_data, va_list ap)
memset(&sentinel, 0, sizeof(sentinel));
cur = &sentinel;
+ res = __res_state();
+
buf = malloc(sizeof(*buf));
if (!buf) {
RES_SET_H_ERRNO(res, NETDB_INTERNAL);
@@ -2253,7 +2255,6 @@ _dns_getaddrinfo(void *rv, void *cb_data, va_list ap)
return NS_UNAVAIL;
}
- res = __res_state();
if ((res->options & RES_INIT) == 0 && res_ninit(res) == -1) {
RES_SET_H_ERRNO(res, NETDB_INTERNAL);
free(buf);
OpenPOWER on IntegriCloud