Blame SOURCES/0013-CVE-2022-37032.patch

10e54d
From ff6db1027f8f36df657ff2e5ea167773752537ed Mon Sep 17 00:00:00 2001
10e54d
From: Donald Sharp <sharpd@nvidia.com>
10e54d
Date: Thu, 21 Jul 2022 08:11:58 -0400
10e54d
Subject: [PATCH] bgpd: Make sure hdr length is at a minimum of what is
10e54d
 expected
10e54d
10e54d
Ensure that if the capability length specified is enough data.
10e54d
10e54d
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
10e54d
---
10e54d
 bgpd/bgp_packet.c | 8 ++++++++
10e54d
 1 file changed, 8 insertions(+)
10e54d
10e54d
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
10e54d
index dbf6c0b2e99..45752a8ab6d 100644
10e54d
--- a/bgpd/bgp_packet.c
10e54d
+++ b/bgpd/bgp_packet.c
10e54d
@@ -2620,6 +2620,14 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt,
10e54d
 				"%s CAPABILITY has action: %d, code: %u, length %u",
10e54d
 				peer->host, action, hdr->code, hdr->length);
10e54d
 
10e54d
+		if (hdr->length < sizeof(struct capability_mp_data)) {
10e54d
+			zlog_info(
10e54d
+				"%pBP Capability structure is not properly filled out, expected at least %zu bytes but header length specified is %d",
10e54d
+				peer, sizeof(struct capability_mp_data),
10e54d
+				hdr->length);
10e54d
+			return BGP_Stop;
10e54d
+		}
10e54d
+
10e54d
 		/* Capability length check. */
10e54d
 		if ((pnt + hdr->length + 3) > end) {
10e54d
 			zlog_info("%s Capability length error", peer->host);