Blame SOURCES/0003-fix-VLAN-device-name-overflow-check.patch

fd9263
From b9885692cb283a674e04528486984fb61f92a190 Mon Sep 17 00:00:00 2001
fd9263
From: Chris Leech <cleech@redhat.com>
fd9263
Date: Tue, 23 Mar 2021 11:21:17 -0700
fd9263
Subject: [PATCH 3/5] fix VLAN device name overflow check
fd9263
fd9263
check snprintf return for truncation
fd9263
fd9263
Signed-off-by: Chris Leech <cleech@redhat.com>
fd9263
---
fd9263
 fipvlan.c | 12 ++++++++++--
fd9263
 1 file changed, 10 insertions(+), 2 deletions(-)
fd9263
fd9263
diff --git a/fipvlan.c b/fipvlan.c
fd9263
index fe8d7955cc5..3ce913d5eaf 100644
fd9263
--- a/fipvlan.c
fd9263
+++ b/fipvlan.c
fd9263
@@ -624,8 +624,16 @@ create_and_start_vlan(struct fcf *fcf, bool vn2vn)
fd9263
 				    real_dev->ifname, fcf->vlan, vlan->ifname);
fd9263
 			rc = 0;
fd9263
 		} else {
fd9263
-			snprintf(vlan_name, IFNAMSIZ, "%s.%d%s",
fd9263
-				 real_dev->ifname, fcf->vlan, config.suffix);
fd9263
+			rc = snprintf(vlan_name, IFNAMSIZ, "%s.%d%s",
fd9263
+					real_dev->ifname, fcf->vlan,
fd9263
+					config.suffix);
fd9263
+			if (rc < 0 || rc >= IFNAMSIZ) {
fd9263
+				printf("Failed to create VLAN device "
fd9263
+					"(name %s.%d%s is too long)\n",
fd9263
+					real_dev->ifname, fcf->vlan,
fd9263
+					config.suffix);
fd9263
+				return -EINVAL;
fd9263
+			}
fd9263
 			rc = vlan_create(fcf->ifindex, fcf->vlan, vlan_name);
fd9263
 			if (rc < 0)
fd9263
 				printf("Failed to create VLAN device %s\n\t%s\n",
fd9263
-- 
fd9263
2.26.2
fd9263