usr.sbin/makefs: fix use-after-free in read_mtree_keywords()
The st variable is used as a shortcut for &node->inode->st, but in one branch just before the exit we update node->inode without changing st. Reported by: AddressSanitizer Reviewed By: emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28570
This commit is contained in:
parent
f44e67d120
commit
12ad8bdb34
@ -783,6 +783,8 @@ read_mtree_keywords(FILE *fp, fsnode *node)
|
||||
free(node->inode);
|
||||
node->inode = curino;
|
||||
node->inode->nlink++;
|
||||
/* Reset st since node->inode has been updated. */
|
||||
st = &node->inode->st;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user