Skip to content

Commit

Permalink
sysfs: fix use_after_free issue
Browse files Browse the repository at this point in the history
CID 73379 (#1 of 1): Use after free (USE_AFTER_FREE)
31. deref_arg: Calling fclose dereferences freed pointer fp.
  • Loading branch information
avagin committed Oct 31, 2014
1 parent 161d756 commit 32d3661
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sysfs_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,9 @@ int parse_aufs_branches(struct mount_info *mi)
* Now read branch pathnames from the branch files.
*/
n = strlen(path);
fp = NULL;
for (br_num = 0; br_num <= br_max; br_num++) {
fp = NULL;

ret = snprintf(&path[n], sizeof path - n, "/br%d", br_num);
if (ret >= sizeof path - n) {
pr_err("Buffer overrun creating path for branch %d\n", br_num);
Expand Down

0 comments on commit 32d3661

Please sign in to comment.