Control: tags -1 + patch

The errors can be fixed with these patches.

Juhani
Description: Explicitly mark fallthrough for GCC-7.
Author: Juhani Numminen <juhaninummin...@gmail.com>
Bug-Debian: https://bugs.debian.org/853521
Last-Update: 2017-12-19

--- a/lldp_mand.c
+++ b/lldp_mand.c
@@ -217,6 +217,7 @@
 			if (length > 0)
 				break;
 			/* Fall through on IP error */
+			__attribute__((fallthrough));
 		case CHASSIS_ID_MAC_ADDRESS:
 		default:
 			length = mand_bld_mac_chassis(md, &chassis);
@@ -234,6 +235,7 @@
 			if (length > 0)
 				break;
 			/* Fall through on IP error */
+			__attribute__((fallthrough));
 		case LLDP_MED_DEVTYPE_NETWORK_CONNECTIVITY:
 		default:
 			length =  mand_bld_ifname_chassis(md, &chassis);
@@ -368,6 +370,7 @@
 				 sizeof(portid.sub);
 			break;
 		}
+		__attribute__((fallthrough));
 	case PORT_ID_NETWORK_ADDRESS:
 		/* uses ipv4 first */
 		if (!get_ipaddr(md->ifname, &portid.id.na.ip.v4)) {
@@ -387,6 +390,7 @@
 				 sizeof(portid.sub);
 			break;
 		}
+		__attribute__((fallthrough));
 	case PORT_ID_INTERFACE_NAME:
 		portid.sub = PORT_ID_INTERFACE_NAME;
 		strncpy((char *)portid.id.ifname, md->ifname, IFNAMSIZ);
--- a/lldp_med_cmds.c
+++ b/lldp_med_cmds.c
@@ -303,6 +303,7 @@
 	case LLDP_MED_DEVTYPE_ENDPOINT_CLASS_III:
 	case LLDP_MED_DEVTYPE_ENDPOINT_CLASS_II:
 		tlv_enabletx(cmd->ifname, cmd->type, (OUI_TIA_TR41 << 8) | LLDP_MED_NETWORK_POLICY);
+		__attribute__((fallthrough));
 	case LLDP_MED_DEVTYPE_ENDPOINT_CLASS_I:
 	case LLDP_MED_DEVTYPE_NETWORK_CONNECTIVITY:
 		tlv_enabletx(cmd->ifname, cmd->type, (OUI_TIA_TR41 << 8) | LLDP_MED_RESERVED);
Description: Allocate larger buffer to avoid truncation.
 The range for uint8 is 0..255 and the string "255% ", with NULL, needs char[6].
 GCC-7 complains:
 lldp_8021qaz_cmds.c:680:30: error: '__builtin___snprintf_chk' output may be
 truncated before the last format character [-Werror=format-truncation=]
 snprintf(cat, sizeof(cat), "%i%% ", percent[i]);
 /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk'
 output between 4 and 6 bytes into a destination of size 5
Author: Juhani Numminen <juhaninummin...@gmail.com>
Bug-Debian: https://bugs.debian.org/853521
Last-Update: 2017-12-19

--- a/lldp_8021qaz_cmds.c
+++ b/lldp_8021qaz_cmds.c
@@ -676,7 +676,7 @@
 
 	strncat(obuf, "tcbw = ", obuf_len - strlen(obuf) - 1);
 	for (i = 0; i < 8; i++) {
-		char cat[5];
+		char cat[6];
 		snprintf(cat, sizeof(cat), "%i%% ", percent[i]);
 		printf("%i%% ", percent[i]);
 		strncat(obuf, cat, obuf_len - strlen(obuf) - 1);

Reply via email to