Page MenuHomeFreeBSD

usr.sbin/makefs: fix use-after-free in read_mtree_keywords()
ClosedPublic

Authored by arichardson on Wed, Feb 10, 12:07 PM.

Details

Summary

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.

Not sure which of the two approaches is preferable

Reported by: AddressSanitizer

Test Plan

ASan no longer complains.

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

usr.sbin/makefs/mtree.c
785–786

I think I like this one slightly better

LGTM. I'd probably not use "avoid UAF" in the comment though, we are resetting st because it has been invalidated by freeing node->inode

This revision is now accepted and ready to land.Wed, Feb 10, 3:07 PM

Update comment and use first approach

This revision now requires review to proceed.Wed, Feb 10, 3:12 PM
This revision is now accepted and ready to land.Wed, Feb 10, 3:13 PM