From nobody Mon Dec 5 21:50:49 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 4NQy0T6G3cz4jf8V; Mon, 5 Dec 2022 21:50:49 +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 4NQy0T5qGrz3tDv; Mon, 5 Dec 2022 21:50:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1670277049; 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=Gxq/HfmPk4wGD8hSLwhuSwKXpLBgFWdlgCroocmO854=; b=giOEteut+ypngNRG7TlpTbwhfAV79PVmbooZHGz6eDTe9iNwpAF1bircqlGIOKm5yvpYeb yo+q7H1OsSQqtv5IZKZxU4vEfPII4QSNDPkFTzWp0OB1buPiVB3Nb9ds/By7K9hP/3C4wV qrnar03JkhEmzxfaXRXoHprwCmmK/PbZcj5VooZzyjErR1rRsiBeGG4bDebt9pRt5OwZYT lG19aN9ZD/qe/Jdev/V5C1NQX+PFcxM1BwOIbA0Ki12cLoZsyodEabgnNhsMzLvi5ctVI7 yq1XAcix+jnSWg9SNTL9bdw4DZAAwycmNt+s8hmfH7DIobod6KfbPHb2hDMEYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1670277049; 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=Gxq/HfmPk4wGD8hSLwhuSwKXpLBgFWdlgCroocmO854=; b=FYXl4ND16eLsGLap0UMrUQGk7ypNrcltD7AFsW4f/vdYcM5wnfnFhP9qhLFn1H/gGQGSwj zwk94094jlekN9t6R+1rfjaqonudICFDOKopFlxHn7Kh+gv2zII74lAAXgZAHSMbSPdkya UYdbzofuIrrsU6mRzqLnEILbd0tH+ScwnG8IlBGndisXEFRg7IgnmkFe9+c0pbu04Arpxf fNBWK8WAldKx+hakbpkdFYqBG22uYrR7/8CvDfjajtUZXnGnvCkQP9ph0wpnUu7bwhFUTW pHXPf0D2KW4u1Wwml7P+0qk4a3fkcT9fQ5srfJcT/mj7X0ObnvP1M69YGaypRw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1670277049; a=rsa-sha256; cv=none; b=em8NEugLlEpTXfFka7KEkr4i/W7uSsf4wByAifB6Szg+5Z9LbWuIQM2sBzjGIMJ5WmJSsT dWw2evgjAEEWEeMQaxdHTOu9e+oxRbUtfdJbGs5dzWKCIHge7W2r16hZvuPZd0pK1WMYxp CjqWBRHueSqCyvfASYEoXkXEi5Rbjz174yRytWMQXeQVBdxPM6Yo8ZvDxfGDgH+cQunPhd YtYaB9lI/2fv/DnXKGDv+Q1tSUVdZSLdb7Mo7kV0fukZ8YZTmuYO86uTgUzdkjwQYNjtUh AVh9Mtx/BO2tICKcj8eIEt2MnX074lUDCxdcoLTB1ylvskKEuKgucqSAsIxofg== 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 4NQy0T4p8Wz1CWW; Mon, 5 Dec 2022 21:50:49 +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 2B5Lonfr094335; Mon, 5 Dec 2022 21:50:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2B5LonQK094334; Mon, 5 Dec 2022 21:50:49 GMT (envelope-from git) Date: Mon, 5 Dec 2022 21:50:49 GMT Message-Id: <202212052150.2B5LonQK094334@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: 78d44cb4b533 - stable/12 - heimdal: Fix bus fault when zero-length request received 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: 78d44cb4b533af106f5cf1ef1603fb1f08f9594a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=78d44cb4b533af106f5cf1ef1603fb1f08f9594a commit 78d44cb4b533af106f5cf1ef1603fb1f08f9594a Author: Cy Schubert AuthorDate: 2022-12-01 00:11:18 +0000 Commit: Cy Schubert CommitDate: 2022-12-05 21:50:44 +0000 heimdal: Fix bus fault when zero-length request received Zero length client requests result in a bus fault when attempting to free malloc()ed pointers within the requests softc. Return an error when the request is zero length. PR: 268062 Reported by: Robert Morris (cherry picked from commit 6742ff42ab3b6e65239f975314060b1393e22d62) --- crypto/heimdal/lib/krb5/read_message.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crypto/heimdal/lib/krb5/read_message.c b/crypto/heimdal/lib/krb5/read_message.c index 4e9bd012dd67..e994b0f09133 100644 --- a/crypto/heimdal/lib/krb5/read_message.c +++ b/crypto/heimdal/lib/krb5/read_message.c @@ -55,6 +55,11 @@ krb5_read_message (krb5_context context, return HEIM_ERR_EOF; } len = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]; + if (len == 0) { + krb5_clear_error_message(context); + return HEIM_ERR_EOF; + } + ret = krb5_data_alloc (data, len); if (ret) { krb5_clear_error_message(context);