memshr: fix off-by-one in filename size check

Signed-off-by: Matthew Daley <mattd@bugfuzz.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
This commit is contained in:
Matthew Daley authored and Ian Campbell committed 2013-11-29 10:29:04 +00:00
1 parent 80507420f9
commit 29f3dc1e07
1 file changed
+2 -2
+2 -2
View File
@@ -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 */
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.