[CRIU] [PATCH 1/9] proc_parse: allocate memory for the terminating null of the string

Andrey Vagin avagin at openvz.org
Thu Apr 4 17:44:27 EDT 2013


CID 996207 (#1 of 1): Out-of-bounds access (OVERRUN)
5. alloc_strlen: Allocating insufficient memory for the terminating null of the string.

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 proc_parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proc_parse.c b/proc_parse.c
index 6c2c2ab..1315aba 100644
--- a/proc_parse.c
+++ b/proc_parse.c
@@ -770,7 +770,7 @@ static int parse_mountinfo_ent(char *str, struct mount_info *new)
 	new->fstype = find_fstype_by_name(fstype);
 	free(fstype);
 
-	new->options = xmalloc(strlen(opt));
+	new->options = xmalloc(strlen(opt) + 1);
 	if (!new->options)
 		return -1;
 
-- 
1.7.11.7



More information about the CRIU mailing list