From nobody Thu Dec 01 14:25:26 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 4NNJJR206wz4jL7t; Thu, 1 Dec 2022 14:25:27 +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 4NNJJR0qSCz3s0y; Thu, 1 Dec 2022 14:25:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669904727; 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=NfCYD3ixGjbX17v9G5RFMSN6nDuia/XuAXfgn4cde0U=; b=H3Vxn1UVBsnJ9Gm8aFAWbaICbc3tUEpkOWkOKeF8R8mg8whddkmOffGC0JnxCSN/IehSa4 WR3chIaNrRWaoXC+cTcPNhUdCNrX98ehK42v13i+Qjmy09WuBOSi/k6y3/Qswyy+WWKDJm J5+yXkOX+bB+T3SgR4CarZrQucQA8ihemMZzBOkQ3yLov9SX2rGz6jmS/CTDzze75rIYOe NQRAuuj7UVZZ5YOJzTiONLJCeZMmwk72q1IF+Leg2fmz+s4+zlgTlyCo4uCr2UboXg1pp9 XrGJUM919Dg6dtG929Ww4XJq9ozp8Z8d1U+LSHh4RMpyyaANpQOp1hWqsuk9LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669904727; 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=NfCYD3ixGjbX17v9G5RFMSN6nDuia/XuAXfgn4cde0U=; b=I4x8beX2pgB/gEc8Cq05itOo6DLNEOZm0Vpwb56cR+SIle8Xk50Lj5ipLsr5QhdqwqEFKl 02va+Bfxa66rYsX+4zddKt678SNU1iCqgQqLCBahmb3mV+GrYFU6/mllz1CCsQN5GFhmKV XkYDl/0aUurECjjVsRi9hLkDpXKNpoksMrC83+WUGJOR8S2pjdxR3xIt/yYFlxn+rLCuNr 1SMuMcX7QIGY4i9V2LRufoSs9XGrdlzCelGmSX+8j5ZIqGmSt2jKwvjpPBMEdcVIryvyt+ /m4sCmvIiHiX4m8OLr/xGp5pA1wZyGTpHFB6RWteMSM4poZN5POHxIbXYMUdhg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1669904727; a=rsa-sha256; cv=none; b=x3N4SnRtMrCSLU7duIvDminiPjvAh5xG9t/xyqMXxkpsoJ9dpIlCDrKhe2j2vvy7HRUVpB fxW3XpWqLC/S7qnRs4n0rFeH7hWo++kfuHodV85d3iDeVo/OwxqV8xfoP7VhRLr1Nt1Nkk /0KMyEwJ56iwUDIjWerYicHBIynMXmkGOrnytcUPUizHaMB16PHh+PZcx1lBpFAe/Ze+Qm PD2RYo7oOPuVI4Jn+M12kpLsBIQdaXZMU6Wk9S7IyJWfNzo0OFD+w8Zknb22wI+cTJWaDi wo5aXfFZo7EmGttsqYljwSKKCNwbX+2UoxGz4Sn9V68j8uxwr4LdJXsBfM58hQ== 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 4NNJJQ6r8JzfWW; Thu, 1 Dec 2022 14:25:26 +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 2B1EPQv7079084; Thu, 1 Dec 2022 14:25:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2B1EPQi4079083; Thu, 1 Dec 2022 14:25:26 GMT (envelope-from git) Date: Thu, 1 Dec 2022 14:25:26 GMT Message-Id: <202212011425.2B1EPQi4079083@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: 387abd40650c - stable/13 - heimdal: Fix NULL dereference when mangled realm message 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: 387abd40650c755f1745533c5b4ec0b85a8b9582 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=387abd40650c755f1745533c5b4ec0b85a8b9582 commit 387abd40650c755f1745533c5b4ec0b85a8b9582 Author: Cy Schubert AuthorDate: 2022-11-24 14:22:13 +0000 Commit: Cy Schubert CommitDate: 2022-12-01 14:25:10 +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);