Sfoglia il codice sorgente

lockd: fix access beyond unterminated strings in prints

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>
Amir Goldstein 6 anni fa
parent
commit
93f38b6fae
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      fs/lockd/host.c

+ 1 - 1
fs/lockd/host.c

@@ -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);
 	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,
 			(int)hostname_len, hostname, rqstp->rq_vers,
 			(rqstp->rq_prot == IPPROTO_UDP ? "udp" : "tcp"));
 			(rqstp->rq_prot == IPPROTO_UDP ? "udp" : "tcp"));