lockd: fix access beyond unterminated strings in prints
authorAmir Goldstein <amir73il@gmail.com>
Fri, 28 Sep 2018 17:41:48 +0000 (20:41 +0300)
committerJ. Bruce Fields <bfields@redhat.com>
Mon, 29 Oct 2018 20:58:04 +0000 (16:58 -0400)
printk format used %*s instead of %.*s, so hostname_len does not limit
the number of bytes accessed from hostname.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/lockd/host.c

index d35cd6be067592acd7f2bc8ca50f0dd869e817e5..93fb7cf0b92b631358cf36eab60d5947cc0312a7 100644 (file)
@@ -341,7 +341,7 @@ struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp,
        };
        struct lockd_net *ln = net_generic(net, lockd_net_id);
 
-       dprintk("lockd: %s(host='%*s', vers=%u, proto=%s)\n", __func__,
+       dprintk("lockd: %s(host='%.*s', vers=%u, proto=%s)\n", __func__,
                        (int)hostname_len, hostname, rqstp->rq_vers,
                        (rqstp->rq_prot == IPPROTO_UDP ? "udp" : "tcp"));