From nobody Thu Dec 1 14:26:04 2022 X-Original-To: dev-commits-src-branches@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 4NNJK8740cz4jLQ9; Thu, 1 Dec 2022 14:26:04 +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 4NNJK86dwhz3vc6; Thu, 1 Dec 2022 14:26:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669904764; 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=iFDAy6fBvA+15axVr9t61+MI1Xp6FtPu7IL+kcakEN8=; b=W8snXvAG6e8x3JRI/zebSgHdzBNinw7tarNaR8nQDACufqAtO0sfGoPB8D0MsZVzEVryio P+mE1jKbtelcaSQegywrshJTFRjoTPRJRlW0984Z+0pq13Gzr79dbFsneBhbc9xTTxiUcm heIPrPXkWTSfML0U7+xVJDqvpJRRazhuU2nZs8c5Z/S0fmOSVoXpV0qvKfsxQ1uVOEV03K I6D0yhRHFz/UhbsRroN5pu3oa0HdEffsgNQJXsDuFYMO5REWuMu7WHiEoQOel30Yh9x7on RaQzADzVmS7Y2fIdM9MWyxZ4N0My50DoskQHQLhwOHMNCJZsNHhcry/8pI6n7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669904764; 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=iFDAy6fBvA+15axVr9t61+MI1Xp6FtPu7IL+kcakEN8=; b=AzsRPNZ1ngaXho86nzVxl0S7aVXiOxZo1ODmtKe9DeYRR+yNzjXEvg9Pn7nvGYoaBjCu8s tZLQY1iEx4cgyGHFjU7vIH31RXE06kQJC6vJVX8mqunHZCL4I86i1D8ouY8E7yunCYK0Nw QngY/S9BLU9tWdPykWrnTNmJ5hg75Djr5Guy2uOpRk7qLXrGe3hjFiykPetj6sxDtT228U TUdqmLe50/K6QgqGdeHI4YvtxS56yxc+5QV7h7DWFRKSsu5gPNnc86iyPDvciNLX7KKrcK afZUQH+huXt7E8heX8hI8ql3QeWZzYMtLyW6t8JohymsdQGfLmrdG8wm30nvSw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1669904764; a=rsa-sha256; cv=none; b=DTq/tT1QEbZb9Ovb1c4A6uQgo1qq/pUzeD7CSnx7ILuuNtSV/NsSQYGl1hOxuhefv7ykRH vkvdByKmEeaNnu2n0CLZivBA10cMBSyoTYEG3Udg8jXVpZ16ROXbko15QDmeWojGUuy+28 qDwvBhiwep0zbV1kdJiuISqu5pYMlf8qTPur/P1ZyIv2Bgb/5Etty0HfSSQ0DHylCCDFH1 AJJVbbdNeCDBFgB6klJK/TTzH+Ze7eXoZ1Kd9ZUA5XZBSIF0LTGDvEfyp5c+me+S0/xCPi ADZx2IsxetGsue7I1b1XvMb651ZgeJqzD8fe1qLh24rMRJuPFJiUwTRfowaCQg== 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 4NNJK85gwpzfxn; Thu, 1 Dec 2022 14:26:04 +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 2B1EQ45c079605; Thu, 1 Dec 2022 14:26:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2B1EQ4gd079604; Thu, 1 Dec 2022 14:26:04 GMT (envelope-from git) Date: Thu, 1 Dec 2022 14:26:04 GMT Message-Id: <202212011426.2B1EQ4gd079604@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: 709a426717c9 - stable/12 - heimdal: Fix NULL dereference when mangled realm message List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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: 709a426717c9d8e9eedf92a07f5410f6c05409ac Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=709a426717c9d8e9eedf92a07f5410f6c05409ac commit 709a426717c9d8e9eedf92a07f5410f6c05409ac Author: Cy Schubert AuthorDate: 2022-11-24 14:22:13 +0000 Commit: Cy Schubert CommitDate: 2022-12-01 14:25:52 +0000 heimdal: Fix NULL dereference when mangled realm message Fix a NULL dereference in _kadm5_s_init_context() when the client sends a mangled realm message. PR: 267912 Reported by: Robert Morris (cherry picked from commit 05bc50bdb1c1ddbbeb853ea4b184aced0eca9b3f) --- crypto/heimdal/kadmin/server.c | 4 +++- crypto/heimdal/lib/kadm5/marshall.c | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/crypto/heimdal/kadmin/server.c b/crypto/heimdal/kadmin/server.c index 256c2bac89b7..2800a2e1fc29 100644 --- a/crypto/heimdal/kadmin/server.c +++ b/crypto/heimdal/kadmin/server.c @@ -516,7 +516,9 @@ handle_v5(krb5_context contextp, ret = krb5_read_priv_message(contextp, ac, &fd, ¶ms); if(ret) krb5_err(contextp, 1, ret, "krb5_read_priv_message"); - _kadm5_unmarshal_params(contextp, ¶ms, &realm_params); + ret = _kadm5_unmarshal_params(contextp, ¶ms, &realm_params); + if(ret) + krb5_err(contextp, 1, ret, "Could not read or parse kadm5 parameters"); } initial = ticket->ticket.flags.initial; diff --git a/crypto/heimdal/lib/kadm5/marshall.c b/crypto/heimdal/lib/kadm5/marshall.c index 65804afbf92b..38b9855021b2 100644 --- a/crypto/heimdal/lib/kadm5/marshall.c +++ b/crypto/heimdal/lib/kadm5/marshall.c @@ -335,8 +335,12 @@ _kadm5_unmarshal_params(krb5_context context, goto out; params->mask = mask; - if(params->mask & KADM5_CONFIG_REALM) + if (params->mask & KADM5_CONFIG_REALM) { ret = krb5_ret_string(sp, ¶ms->realm); + if (params->realm == NULL) { + ret = EINVAL; + } + } out: krb5_storage_free(sp);