xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Daley <mattd@bugfuzz.com>
To: xen-devel@lists.xenproject.org
Cc: xen-devel@lists.xen.org, Matthew Daley <mattd@bugfuzz.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH] memshr: fix off-by-one in filename size check
Date: Thu, 28 Nov 2013 23:17:11 +1300	[thread overview]
Message-ID: <1385633831-12816-1-git-send-email-mattd@bugfuzz.com> (raw)

Signed-off-by: Matthew Daley <mattd@bugfuzz.com>
---
 tools/memshr/shm.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/memshr/shm.c b/tools/memshr/shm.c
index c925cf2..30975dc 100644
--- a/tools/memshr/shm.c
+++ b/tools/memshr/shm.c
@@ -217,9 +217,9 @@ uint16_t shm_vbd_image_get(const char* file, vbd_image_info_t *vbd_imgs)
         DPRINTF("No space in vbds table.\n");
         return 0;
     }
-    if(strlen(file) > MAX_NAME_LEN)
+    if(strlen(file) > MAX_NAME_LEN - 1)
     {
-        DPRINTF("Filename: %s too long (>%d).\n", file, MAX_NAME_LEN);
+        DPRINTF("Filename: %s too long (>%d).\n", file, MAX_NAME_LEN - 1);
         return 0; 
     }
     /* Init the entry */
-- 
1.7.10.4

             reply	other threads:[~2013-11-28 10:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-28 10:17 Matthew Daley [this message]
2013-11-29 10:35 ` [PATCH] memshr: fix off-by-one in filename size check Ian Campbell
2013-11-29 15:17   ` Andres Lagar-Cavilla
2013-11-29 15:46     ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1385633831-12816-1-git-send-email-mattd@bugfuzz.com \
    --to=mattd@bugfuzz.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).