virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [patch -next] tcm_vhost: another strlen() off by one
@ 2012-07-13 10:45 Dan Carpenter
  2012-07-14 22:21 ` Nicholas A. Bellinger
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2012-07-13 10:45 UTC (permalink / raw)
  To: Michael S. Tsirkin, Nicholas Bellinger
  Cc: kernel-janitors, kvm, virtualization

strlen() doesn't count the NUL terminator.  I missed this one in the
patches I sent yesterday.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c
index 29850cb..ea72198 100644
--- a/drivers/vhost/tcm_vhost.c
+++ b/drivers/vhost/tcm_vhost.c
@@ -1424,7 +1424,7 @@ static struct se_wwn *tcm_vhost_make_tport(
 	return ERR_PTR(-EINVAL);
 
 check_len:
-	if (strlen(name) > TCM_VHOST_NAMELEN) {
+	if (strlen(name) >= TCM_VHOST_NAMELEN) {
 		pr_err("Emulated %s Address: %s, exceeds"
 			" max: %d\n", name, tcm_vhost_dump_proto_id(tport),
 			TCM_VHOST_NAMELEN);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-14 22:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-13 10:45 [patch -next] tcm_vhost: another strlen() off by one Dan Carpenter
2012-07-14 22:21 ` Nicholas A. Bellinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).