Blame SOURCES/fcoe-utils-gcc7-fmt-truc-err.patch

e1972f
diff --git a/fipvlan.c b/fipvlan.c
e1972f
index 7c00c7c..065b742 100644
e1972f
--- a/fipvlan.c
e1972f
+++ b/fipvlan.c
e1972f
@@ -621,8 +621,10 @@ create_and_start_vlan(struct fcf *fcf, bool vn2vn)
e1972f
 				    real_dev->ifname, fcf->vlan, vlan->ifname);
e1972f
 			rc = 0;
e1972f
 		} else {
e1972f
-			snprintf(vlan_name, IFNAMSIZ, "%s.%d%s",
e1972f
-				 real_dev->ifname, fcf->vlan, config.suffix);
e1972f
+			rc = snprintf(vlan_name, IFNAMSIZ, "%s.%d%s",
e1972f
+				      real_dev->ifname, fcf->vlan, config.suffix);
e1972f
+			if (rc >= IFNAMSIZ)
e1972f
+				return -E2BIG;
e1972f
 			rc = vlan_create(fcf->ifindex, fcf->vlan, vlan_name);
e1972f
 			if (rc < 0)
e1972f
 				printf("Failed to create VLAN device %s\n\t%s\n",
e1972f
diff --git a/libopenfcoe.c b/libopenfcoe.c
e1972f
index 07090d5..98fb975 100644
e1972f
--- a/libopenfcoe.c
e1972f
+++ b/libopenfcoe.c
e1972f
@@ -59,6 +59,7 @@ static int add_fcoe_fcf_device(struct dirent *dp, void *arg)
e1972f
 {
e1972f
 	struct fcoe_ctlr_device *ctlr = (struct fcoe_ctlr_device *)arg;
e1972f
 	struct fcoe_fcf_device *fcf;
e1972f
+	int rc;
e1972f
 
e1972f
 	if (!strstr(dp->d_name, "fcf") ||
e1972f
 	    (!strcmp(dp->d_name, "fcf_dev_loss_tmo")))
e1972f
@@ -71,8 +72,10 @@ static int add_fcoe_fcf_device(struct dirent *dp, void *arg)
e1972f
 	memset(fcf, 0, sizeof(struct fcoe_fcf_device));
e1972f
 
e1972f
 	/* Save the path */
e1972f
-	snprintf(fcf->path, sizeof(fcf->path),
e1972f
-		 "%s/%s", ctlr->path, dp->d_name);
e1972f
+	rc = snprintf(fcf->path, sizeof(fcf->path),
e1972f
+		      "%s/%s", ctlr->path, dp->d_name);
e1972f
+	if (rc >= sizeof(fcf->path))
e1972f
+		goto fail;
e1972f
 
e1972f
 	/* Use the index from the logical enumeration */
e1972f
 	fcf->index = atoi(dp->d_name + sizeof("fcf_") - 1);
e1972f
@@ -198,7 +201,9 @@ static int read_fcoe_ctlr_device(struct dirent *dp, void *arg)
e1972f
 	sa_sys_read_line(ctlr->path, "mode", buf, sizeof(buf));
e1972f
 	sa_enum_encode(fip_conn_type_table, buf, &ctlr->mode);
e1972f
 
e1972f
-	snprintf(lesb_path, sizeof(lesb_path), "%s/lesb/", ctlr->path);
e1972f
+	rc = snprintf(lesb_path, sizeof(lesb_path), "%s/lesb/", ctlr->path);
e1972f
+	if (rc >= sizeof(lesb_path))
e1972f
+		goto fail;
e1972f
 
e1972f
 	/* Get LESB statistics */
e1972f
 	sa_sys_read_u32(lesb_path, "link_fail",