From owner-svn-src-stable@freebsd.org Thu Dec 17 16:08:29 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91667A4945D; Thu, 17 Dec 2015 16:08:29 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5FC8718CE; Thu, 17 Dec 2015 16:08:29 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBHG8S76006672; Thu, 17 Dec 2015 16:08:28 GMT (envelope-from ume@FreeBSD.org) Received: (from ume@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBHG8Sbh006671; Thu, 17 Dec 2015 16:08:28 GMT (envelope-from ume@FreeBSD.org) Message-Id: <201512171608.tBHG8Sbh006671@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ume set sender to ume@FreeBSD.org using -f From: Hajimu UMEMOTO Date: Thu, 17 Dec 2015 16:08:28 +0000 (UTC) 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 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Dec 2015 16:08:29 -0000 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);