OSDN Git Service

Merge tag 'vfs-5.8-merge-2' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
[tomoyo/tomoyo-test1.git] / net / ax25 / af_ax25.c
index ff57ea8..fd91cd3 100644 (file)
@@ -635,8 +635,10 @@ static int ax25_setsockopt(struct socket *sock, int level, int optname,
                break;
 
        case SO_BINDTODEVICE:
-               if (optlen > IFNAMSIZ)
-                       optlen = IFNAMSIZ;
+               if (optlen > IFNAMSIZ - 1)
+                       optlen = IFNAMSIZ - 1;
+
+               memset(devname, 0, sizeof(devname));
 
                if (copy_from_user(devname, optval, optlen)) {
                        res = -EFAULT;