From nobody Thu Dec 01 14:25:29 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 4NNJJT3RZVz4jLDZ; Thu, 1 Dec 2022 14:25:29 +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 4NNJJT2ynpz3sVb; Thu, 1 Dec 2022 14:25:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669904729; 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=USsWIQe0XQXjByXdbK47JlndVVPHnWSLahYNKSfTYKo=; b=do9eAF8hQm6A6eklvii+k84CD1e8753VqIEOPk8UUxilDabjKlBQbnF4nxXkI9/WH8obj8 BUnvQZv1OVxLJfPn3mRMLxQD9SAwpgoV+P8zsfXyEAwS7fzDPCEdH1h4x3u6IJOqy5e3dv 2HF0RuqUPJMdGU6zsrcMUkFNNSug6ZsS22xsKeqCD0DG9dkI2o14JfGxNE7T27vR2GDl3S afpz0ftHmd9K3IaJx/cw5tnqbNR8AzHT7I3LR0D93HDqa1FZtPV1/+nmfahHeo//afVoDx PlgqPE0hkI2dGLNu9/1yyifLq+GYHp9D561THwXoNYBgcQkorKcKM+Ofqtej8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669904729; 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=USsWIQe0XQXjByXdbK47JlndVVPHnWSLahYNKSfTYKo=; b=aapw5joHBgvKxHVpYwdk5k6Ntz6yN9szQoASDn9VrUeDqodyf/ZvD99MQ/wRf8lelY684p dtKeBOX7VFOVzzJTwOZIKoFnDsR2FTeiUD4kABGLZb6F1eIfnEmz/i5ZrtqJlnTmPHTEBq ydyrMAExypWw6t9DSWmXGOSERhwTT1jBGVTcKdrS+2A98dppDtu3oMY4SRYHr8+lAOWOEy gobIdP4/X8gxbCyJVVSSGXkDp0SBm51AMfr811ltkjxXrESkpPkoHvVqFJSU+8KyX1SWIR s5GqfLk1inltt/DiXd0j4PfQQKBs21B5HZvED7WvAKrcAegUnzQpnaz+CtzyaQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1669904729; a=rsa-sha256; cv=none; b=FPw9lTWhUnT2GrdelgxOVu/qboZ4rLXP4WVgAj5JEU3rXNnEIbV51Yf/aty6mOHCJN02GM ZwPQYPk7GCqVLgRKdF7n0kdtRLIAzjNaJxhA576T+d9W0sPol1px03ZehANP+Q4xdD/aNq oauPCS1BV9hEV2r/n3i3w4+MsyE4UVP0EwjR3LhWK5xnhBjXmQe0t14w1n55CRtB4nwZjZ 9SaVubTLR67DuBmkvlir6DHQnPOYxmgkKWt3FEQHCgiQwuTVUEFQRK9mHhKVJheQWwDEmA iPJHJomsHdC/o1qKmsSDQL8mw2ksVEDFWvS87v68eW4QHlKYoT3sgKwQp4DDuw== 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 4NNJJT1sRDzfv2; Thu, 1 Dec 2022 14:25:29 +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 2B1EPTxU079142; Thu, 1 Dec 2022 14:25:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2B1EPTtF079141; Thu, 1 Dec 2022 14:25:29 GMT (envelope-from git) Date: Thu, 1 Dec 2022 14:25:29 GMT Message-Id: <202212011425.2B1EPTtF079141@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: fed526b0af2b - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: fed526b0af2bd709f8d187f0c7529d710d3a1bb0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=fed526b0af2bd709f8d187f0c7529d710d3a1bb0 commit fed526b0af2bd709f8d187f0c7529d710d3a1bb0 Author: Cy Schubert AuthorDate: 2022-11-25 23:29:14 +0000 Commit: Cy Schubert CommitDate: 2022-12-01 14:25:10 +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) {