CVE-2022-3437 third_party/heimdal: Check for overflow in _gsskrb5_get_mech()
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Mon, 10 Oct 2022 07:33:09 +0000 (20:33 +1300)
committerJule Anger <janger@samba.org>
Mon, 24 Oct 2022 05:27:37 +0000 (07:27 +0200)
commit22dd9072c9f964931db931ee0b638a9799e947ca
tree8768534a1c87b3caa0322ebedb61b7249a9629f0
parentd16ac1f4057ec0c26768f04f00c512abf271be7f
CVE-2022-3437 third_party/heimdal: Check for overflow in _gsskrb5_get_mech()

If len_len is equal to total_len - 1 (i.e. the input consists only of a
0x60 byte and a length), the expression 'total_len - 1 - len_len - 1',
used as the 'len' parameter to der_get_length(), will overflow to
SIZE_MAX. Then der_get_length() will proceed to read, unconstrained,
whatever data follows in memory. Add a check to ensure that doesn't
happen.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15134

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
selftest/knownfail.d/heimdal-des-overflow
third_party/heimdal/lib/gssapi/krb5/decapsulate.c