Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f67ed26f authored by David S. Miller's avatar David S. Miller Committed by David S. Miller
Browse files

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



Found by Solar Designer.

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a1a8feed
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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;