Author: ume
Date: Thu Dec 17 16:08:28 2015
New Revision: 292403
URL: https://svnweb.freebsd.org/changeset/base/292403
Log:
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
Modified:
stable/10/lib/libc/net/getaddrinfo.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/lib/libc/net/getaddrinfo.c
==============================================================================
--- stable/10/lib/libc/net/getaddrinfo.c Thu Dec 17 14:41:30 2015
(r292402)
+++ stable/10/lib/libc/net/getaddrinfo.c Thu Dec 17 16:08:28 2015
(r292403)
@@ -2207,6 +2207,8 @@ _dns_getaddrinfo(void *rv, void *cb_data
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
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);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"