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

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