diff options
-rw-r--r-- | net/core/sock.c | 5 |
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; |