Skip to content

Commit

Permalink
proc_parse: allocate memory for the terminating null of the string
Browse files Browse the repository at this point in the history
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@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
  • Loading branch information
avagin authored and xemul committed Apr 5, 2013
1 parent 9c3a88c commit 4ef1524
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion proc_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 4ef1524

Please sign in to comment.