A free Windows-compatible Operating System - mirrored from GitHub
Go to file
Pierre Schweitzer 74ed7ffd30 [NTFS]
Totally rewrite the way MFT records attributes are handled.
Up to now, we were having really similar loops, only looking at the resident part of the attribute list, not really caring about how the loop was going.

This was leading to some issues:
- In case the attribute we were looking for was stored in the non-resident part of the attribute list, we would miss it (excepted in the case of FindAttribute() which was properly browsing the whole attribute list).
- In the specific case of FindAttribute(), one would have been able to setup a broken MFT record with the resident attribute list pointing on the non resident attribute list which itself would point to the resident attribute list. In such case, the driver would loop forever caught on the loop, allocating tones of memory. It was possible to trigger this by user space, from a non-privileged user, just by browsing the right directory entry.
- In the case of the other loops (non FindAttribute()), another issue (other than missing attributes) was present, one would have been able to setup a broken MFT record with an attribute of null-length. This would have caused the driver to loop forever on the attribute list. This could be triggered from usermode too. And could be triggered by a non-privileged user.

This commit introduces a new set of functions for attributes browsing: FindFirstAttribute(), FindNextAttribute(), FindCloseAttribute(). It allows safely browsing attributes and handles broken cases. It also performs reading of the attribute list when present and makes sure there's only one read. This method should be the only one to use to browse the attributes.
The whole NTFS code base has been converted to use this newly set of functions. This really simplifies the implementation of FindAttribute(), and prevent unsafe code duplication.

CORE-10037 #resolve #comment Fixed with r68829

svn path=/trunk/; revision=68829
2015-08-26 18:20:04 +00:00
reactos [NTFS] 2015-08-26 18:20:04 +00:00
rosapps [HACKSSIGN] 2015-08-23 17:33:15 +00:00
rossubsys Resuscitate VMS subsystem (yeah, you've correctly read: VMS!!) from revision 24496. 2014-11-23 15:24:49 +00:00
rostests [GDI32_APITEST] 2015-08-18 10:24:01 +00:00
wallpapers Rename 'wallpaper' repo to 'wallpapers' (since it doesn't contain only 1 wallpaper :p ) 2015-03-15 16:06:50 +00:00