From owner-p4-projects@FreeBSD.ORG Mon May 31 08:33:13 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0CAB81065676; Mon, 31 May 2010 08:33:13 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4DFB1065674 for ; Mon, 31 May 2010 08:33:12 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (unknown [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id B15F88FC19 for ; Mon, 31 May 2010 08:33:12 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o4V8XCi3032760 for ; Mon, 31 May 2010 08:33:12 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o4V8XCGU032758 for perforce@freebsd.org; Mon, 31 May 2010 08:33:12 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Mon, 31 May 2010 08:33:12 GMT Message-Id: <201005310833.o4V8XCGU032758@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 179007 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2010 08:33:13 -0000 http://p4web.freebsd.org/@@179007?ac=10 Change 179007 by rwatson@rwatson_cinnamon on 2010/05/31 08:32:41 Don't dereference a NULL pointer if memory allocation fails in au_to_socket_sx(). Affects only the userspace BSM code, as kernel BSM allocates tokens using M_WAITOK. Reported by: clang static analyzer Affected files ... .. //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#94 edit Differences ... ==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#94 (text+ko) ==== @@ -30,7 +30,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#93 $ + * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#94 $ */ #include @@ -968,6 +968,8 @@ errno = EINVAL; return (NULL); } + if (t == NULL) + return (NULL); ADD_U_CHAR(dptr, AUT_SOCKET_EX); ADD_U_INT16(dptr, au_domain_to_bsm(so_domain));