aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2006-03-24 01:47:40 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-03-24 18:44:59 -0500
commitf67ed26f2b3e92c0450deae3ffc3fff21c878a75 (patch)
treec4dcdb47cfb5f3ba498698cd13421d204047b219 /net/core
parenta1a8feed1743ec8d2af1dafa7c5321679f0a3e4f (diff)
[NET]: Ensure device name passed to SO_BINDTODEVICE is NULL terminated.
Found by Solar Designer. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/sock.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 1a7e6eac90b0..e110b9004147 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -404,8 +404,9 @@ set_rcvbuf:
404 if (!valbool) { 404 if (!valbool) {
405 sk->sk_bound_dev_if = 0; 405 sk->sk_bound_dev_if = 0;
406 } else { 406 } else {
407 if (optlen > IFNAMSIZ) 407 if (optlen > IFNAMSIZ - 1)
408 optlen = IFNAMSIZ; 408 optlen = IFNAMSIZ - 1;
409 memset(devname, 0, sizeof(devname));
409 if (copy_from_user(devname, optval, optlen)) { 410 if (copy_from_user(devname, optval, optlen)) {
410 ret = -EFAULT; 411 ret = -EFAULT;
411 break; 412 break;