diff options
author | ume <ume@FreeBSD.org> | 2015-12-10 11:11:44 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2015-12-10 11:11:44 +0000 |
commit | f4f7ae3e2a6ea35712dbcc0a66a82e95cbb9b627 (patch) | |
tree | bd24b8557dd8cfaaad3a60b8cdc51a102cca6538 /lib/libc | |
parent | e09be5260d7ca50f73cc145d068230b0f053570f (diff) | |
download | FreeBSD-src-f4f7ae3e2a6ea35712dbcc0a66a82e95cbb9b627.zip FreeBSD-src-f4f7ae3e2a6ea35712dbcc0a66a82e95cbb9b627.tar.gz |
The calls to RES_SET_H_ERRNO() macro on error paths wind up
dereferencing an uninitialized res.
PR: 202142
Submitted by: Sean Boudreau
MFC after: 1 week
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/net/getaddrinfo.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c index 95c588b..2117370 100644 --- a/lib/libc/net/getaddrinfo.c +++ b/lib/libc/net/getaddrinfo.c @@ -2208,6 +2208,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); @@ -2254,7 +2256,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); |