On Tue, 31 Jan 2017 09:31:15 +0000 Matthias Klose <d...@debian.org> wrote:
> Package: src:fcoe-utils
> Version: 1.0.29+git20140505-1
> Severity: normal
> Tags: sid buster
> User: debian-...@lists.debian.org
> Usertags: ftbfs-gcc-7
> ...
> gcc -DPACKAGE_NAME=\"fcoe-utils\" -DPACKAGE_TARNAME=\"fcoe-utils\" 
> -DPACKAGE_VERSION=\"1.0.29\" -DPACKAGE_STRING=\"fcoe-utils\ 1.0.29\" 
> -DPACKAGE_BUGREPORT=\"fcoe-de...@open-fcoe.org\" -DPACKAGE_URL=\"\" 
> -DPACKAGE=\"fcoe-utils\" -DVERSION=\"1.0.29\" -I.  -I./include -I./include 
> -DSYSCONFDIR="\"/etc\"" -D_FORTIFY_SOURCE=2 -Wdate-time -D_FORTIFY_SOURCE=2 
> -Wall -Wformat=2 -Werror -Wmissing-prototypes -Wstrict-prototypes -g -O2 
> -fdebug-prefix-map=/<<BUILDDIR>>/fcoe-utils-1.0.29+git20140505=. 
> -fstack-protector-strong -Wformat -Werror=format-security -MT libopenfcoe.o 
> -MD -MP -MF $depbase.Tpo -c -o libopenfcoe.o libopenfcoe.c &&\
> mv -f $depbase.Tpo $depbase.Po
> libopenfcoe.c: In function 'add_fcoe_fcf_device':
> libopenfcoe.c:75:8: error: '%s' directive output may be truncated writing 
> between 0 and 255 bytes into a region of size 0 [-Werror=format-truncation=]
>     "%s/%s", ctlr->path, dp->d_name);
>         ^~

Fedora has a newer upstream version, but they have a patch related to this:
https://src.fedoraproject.org/rpms/fcoe-utils/blob/master/f/fcoe-utils-ggc7-fmt-truc-err.patch
I have modified it to apply to the Debian package.

However, even after applying the attached patch, the package FTBFS:

fcping.c: In function 'fp_find_hba':
fcping.c:591:9: error: '%s' directive output may be truncated writing up to 255 
bytes into a region of size 61 [-Werror=format-truncation=]
     "fc_%s", port_attrs.OSDeviceName);
         ^~   ~~~~~~~~~~


Best regards,
Juhani
Description: patch to fix up gcc7 build errors due to Werror=format-truncation
Origin: https://src.fedoraproject.org/rpms/fcoe-utils/blob/master/f/fcoe-utils-ggc7-fmt-truc-err.patch
Bug-Debian: https://bugs.debian.org/853398
Last-Update: 2017-12-14

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

Reply via email to