mirror of
https://github.com/torvalds/linux.git
synced 2024-11-16 09:02:00 +00:00
bonding: fix off-by-one error
Fix off-by-one error because IFNAMSIZ == 16 and when this code gets executed we stick a NULL byte where we should not. How to reproduce: with CONFIG_CC_STACKPROTECTOR=y (otherwise it may pass by silently) modprobe bonding; echo 1 > /sys/class/net/bond0/bonding/mode; echo "AAAAAAAAAAAAAAAA" > /sys/class/net/bond0/bonding/primary; Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
477864ddd3
commit
eb6e98a1b2
@ -1060,7 +1060,7 @@ static ssize_t bonding_store_primary(struct device *d,
|
||||
goto out;
|
||||
}
|
||||
|
||||
sscanf(buf, "%16s", ifname); /* IFNAMSIZ */
|
||||
sscanf(buf, "%15s", ifname); /* IFNAMSIZ */
|
||||
|
||||
/* check to see if we are clearing primary */
|
||||
if (!strlen(ifname) || buf[0] == '\n') {
|
||||
|
Loading…
Reference in New Issue
Block a user