Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Dec 2015 16:08:28 +0000 (UTC)
From:      Hajimu UMEMOTO <ume@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r292403 - stable/10/lib/libc/net
Message-ID:  <201512171608.tBHG8Sbh006671@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512171608.tBHG8Sbh006671>