From nobody Thu Nov 24 17:26:41 2022 X-Original-To: dev-commits-src-main@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 4NJ4fp1gGjz4hhS0; Thu, 24 Nov 2022 17:26:42 +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 4NJ4fp16Whz3QWm; Thu, 24 Nov 2022 17:26:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669310802; 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=6MtfZMCYROnLNrYjp3JgW+kmosiKtyu/8CF59ADrCmw=; b=Uiq7WLBdq11mtnRHmWIfO/KN4BcHuj19YtONn4hjiFhTSgn280cPw7uqDuZT1Q6bEkH0re +pe1RostvoxqBTfE77QDASmFbQmlgIV132lH6Pf4n4HgrQyNRQ+quXmLqaN8hbOdHj22ZO oFmldB1b0hBWYUcMI+sp+CK4KqNz+O+JBLHmnpKE+hyaipKHmxoMljqPtm5IIV+2Ftl809 DPHuHwRQz5kZPyno7HIxLUtyxLEpNW4Iq6j2zNAZp583uMmMTfQtvsSJ75CBms1tE5xSoT GsD0HV+Q/VobWamUuBG6UczjLozOfdHpXfBKbw6h24mTnW7Qn2e2CcrqUPJzvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669310802; 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=6MtfZMCYROnLNrYjp3JgW+kmosiKtyu/8CF59ADrCmw=; b=xRi1fbEFwSznBaqQRddyxHDhJiITSv9Q2MPpFTbAhGX0OVRDbrvciMF31F7DEJyNBY5nKF LN3EaDts0isvQmwqQ+jhrLwOHDHB5svrqFycp6UatISE1ca4ZWIYJozLpQP2SbsME2ASaC 95BiBu37C9MTyPgvtrseFSIelLklg4OtmvBs/q3EDvRdg/qJZwTe0/oLKBY9+BHqpUSD5F QsMsLTtHCrv1Ie96voloZLUeoT4EG2zAaglAycvrjLbKTqaRWVaBgNe2htNsR2uGONAAUO 4LiNtOYPwLOFo7WpxifDhhNN1zlx/QdgzEGYrD0ADhMDrvLcLGLGmTEYogbaxw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1669310802; a=rsa-sha256; cv=none; b=Anlbs6kKweqcuJRMbipBNr1BCuuPsn3hhx/O+5uNk/6HxqzV4mXZWSjt7Ug2QQz7PC4wny B1x1mmK1OAm3f3TvBQ3QMJbbZqpXoq11ACYw+Dh4wsPzgzkeK4msI8sITxEC8USMG2gaQg mXWToTMMOW0mRpPRW91sDWkIzVah1e6CSbTJBCuMBt2PRYqDLhZ0bOWUMplGTkuG+6PPAD j6CAkk2534Gu5HSUCsPamTu0YbCIug0wTAXL3Diz10XKkTJCaxm+H5udmNNnho2HcysRfP 4+DPmuK0fco9Do+wUqsnJ/mulf+tlCCQONKTZ9AHwFbHOP2ji6abqqF7VXot2w== 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 4NJ4fp0DSYz18QB; Thu, 24 Nov 2022 17:26:42 +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 2AOHQfIN008892; Thu, 24 Nov 2022 17:26:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2AOHQfaL008891; Thu, 24 Nov 2022 17:26:41 GMT (envelope-from git) Date: Thu, 24 Nov 2022 17:26:41 GMT Message-Id: <202211241726.2AOHQfaL008891@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: 05bc50bdb1c1 - main - heimdal: Fix NULL dereference when mangled realm message List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 05bc50bdb1c1ddbbeb853ea4b184aced0eca9b3f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=05bc50bdb1c1ddbbeb853ea4b184aced0eca9b3f commit 05bc50bdb1c1ddbbeb853ea4b184aced0eca9b3f Author: Cy Schubert AuthorDate: 2022-11-24 14:22:13 +0000 Commit: Cy Schubert CommitDate: 2022-11-24 17:21:13 +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 MFC after: 3 days --- 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);