From nobody Thu Dec 01 14:26:07 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NNJKC1q3Pz4jLQH; Thu, 1 Dec 2022 14:26:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NNJKC1JWNz3vvn; Thu, 1 Dec 2022 14:26:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669904767; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6uNEXvrjQucH+QhvWf/b1sMyF2xKEc128MdHshI51Zw=; b=WI9B/Hn90FpPhI0gIHA1w0nX1KDi9S40GwEBa+cfFLmh+gY6S/0OUj8OLunKju8dgiVEpY jM+y3PI+Jm+mrYklGPtQMyM8YvkEzA3e7tGR+WtqLS8nvlq4pdgZIACQw0OAeRHuzy9WCV zKr5+IkXngcPNesk5EQgwSkXddGiUXjkxN4BXq01b18OB6zGf0gkKA1F3ycweCSHTjcCX+ Qetw9amRVGpKOxZnScMEYr9xISkGJEewbmr+9rxDC7FSAUSXapepCK4d2OCGMdcZjcE29A ihvCRiHUKW8RGwCqhe/EY09gGRsBQsYnWb8a561BdkgrJNBvUuUXuCc9BkcOsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669904767; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6uNEXvrjQucH+QhvWf/b1sMyF2xKEc128MdHshI51Zw=; b=LU1ve7zSyqK6Jfel2Ne91FKtbhYSAK2xTIRwIGsR3dnqXNu6Y49kYkJ9ZdifuJHssBSLze E+MTuOeCw68mB7aq+DnXp1CZfMrbU9gkaEKDHfpY6F2Wyc4LLhjiE7W3y4Z3c9zfTX/n8w kxj7g6Rp7hRvUeG5RDe4Hzp0Sdmlzof2DoqbHSt30tudSsm9AckTdOQFSL87OFwesqiEUr GjSfoPnEAZM6b57L2e9qHpsskCdg0DAvbBI6jXt0YOtxKoFkzZVMvrW7/T9cOg5erjYAYh A3enIFvx0qwcIuT8h4K6tmXoB/MWWqliNe6oTpcgw34OPdoyPnR9RgkA9t1hqQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1669904767; a=rsa-sha256; cv=none; b=GfGl1kYtolCDPsMZlnIWI3mYlOygCjp/oIcunqRdzWVBojDQOcQOxmYYwPIW4bDCxsizds RRJS6aY55sh7RRg6/EDS7+EEqnLmj5721KCRwEZ5HS5HKD31zeWt/uHmtZs+/98f7SfEVq kCZPojbCcsYaVrnv2/Mvg5rS00x/qe0xsa7LT4ikxnqhTQu/B6i2/MGs6u0DnxR6UEe6iO /PcHAlKQ9CDcFD1weyJawcRpFGmb2TMhXcJXYVVDgCCQFwrOsvAp7B/fuQVkLx6sIeqARo Syyxrk1zWPdCS4142Pmf1HBh+9i7TATE1ZlKzsDOdshTAEIKsxUgM1kwZ/WCwA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NNJKC0QhgzgGv; Thu, 1 Dec 2022 14:26:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2B1EQ7EQ079653; Thu, 1 Dec 2022 14:26:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2B1EQ6TM079652; Thu, 1 Dec 2022 14:26:07 GMT (envelope-from git) Date: Thu, 1 Dec 2022 14:26:07 GMT Message-Id: <202212011426.2B1EQ6TM079652@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Cy Schubert Subject: git: 92586930433d - stable/12 - heimdal: Fix uninitialized pointer dereference List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 92586930433d215a606a9a50bfaa5358e4540acc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=92586930433d215a606a9a50bfaa5358e4540acc commit 92586930433d215a606a9a50bfaa5358e4540acc Author: Cy Schubert AuthorDate: 2022-11-25 23:29:14 +0000 Commit: Cy Schubert CommitDate: 2022-12-01 14:25:52 +0000 heimdal: Fix uninitialized pointer dereference krb5_ret_preincipal() returns a non-zero return code when a garbage principal is passed to it. Unfortunately ret_principal_ent() does not check the return code, with garbage pointing to what would have been the principal. This results in a segfault when free() is called. PR: 267944, 267972 Reported by: Robert Morris (cherry picked from commit e13150e28c93d9e74f419dcd17d2e2bad41715ad) --- crypto/heimdal/lib/kadm5/marshall.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/crypto/heimdal/lib/kadm5/marshall.c b/crypto/heimdal/lib/kadm5/marshall.c index fa7388b692fe..292cdf6107e8 100644 --- a/crypto/heimdal/lib/kadm5/marshall.c +++ b/crypto/heimdal/lib/kadm5/marshall.c @@ -187,9 +187,9 @@ ret_principal_ent(krb5_storage *sp, int i; int32_t tmp; - if (mask & KADM5_PRINCIPAL) - krb5_ret_principal(sp, &princ->principal); - + if (mask & KADM5_PRINCIPAL) + if (krb5_ret_principal(sp, &princ->principal)) + return EINVAL; if (mask & KADM5_PRINC_EXPIRE_TIME) { krb5_ret_int32(sp, &tmp); princ->princ_expire_time = tmp; @@ -208,9 +208,10 @@ ret_principal_ent(krb5_storage *sp, } if (mask & KADM5_MOD_NAME) { krb5_ret_int32(sp, &tmp); - if(tmp) - krb5_ret_principal(sp, &princ->mod_name); - else + if(tmp) { + if (krb5_ret_principal(sp, &princ->mod_name)) + return EINVAL; + } else princ->mod_name = NULL; } if (mask & KADM5_MOD_TIME) {