1
0
Fork 0

[NET]: Ensure device name passed to SO_BINDTODEVICE is NULL terminated.

Found by Solar Designer.

Signed-off-by: David S. Miller <davem@davemloft.net>
hifive-unleashed-5.1
David S. Miller 2006-03-23 22:47:40 -08:00 committed by David S. Miller
parent a1a8feed17
commit f67ed26f2b
1 changed files with 3 additions and 2 deletions

View File

@ -404,8 +404,9 @@ set_rcvbuf:
if (!valbool) {
sk->sk_bound_dev_if = 0;
} else {
if (optlen > IFNAMSIZ)
optlen = IFNAMSIZ;
if (optlen > IFNAMSIZ - 1)
optlen = IFNAMSIZ - 1;
memset(devname, 0, sizeof(devname));
if (copy_from_user(devname, optval, optlen)) {
ret = -EFAULT;
break;