From 02ada7a28b9390625d29aad6308f623df930342a Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Thu, 8 Dec 2022 00:57:08 +0200 Subject: treewide: fix use of IFNAMSIZ IFNAMSIZ already includes an extra byte for the null character terminating the string. Adding an extra byte can cause the interface name to be truncated, resulting in undefined behaviour. Drop the extra byte. For the bonding case, the interface name written to sysfs should be prefixed with + or - so we do need an extra byte. Signed-off-by: Stijn Tintel --- device.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'device.h') diff --git a/device.h b/device.h index 37f8c37..6751628 100644 --- a/device.h +++ b/device.h @@ -219,7 +219,7 @@ struct device { struct vlist_tree vlans; struct kvlist vlan_aliases; - char ifname[IFNAMSIZ + 1]; + char ifname[IFNAMSIZ]; int ifindex; struct blob_attr *config; -- cgit v1.2.1