Skip to content

Commit ec0cc84

Browse files
committed
[ATTRIB] De-duplicate code; handle reparse points; verify path concatenation (reactos#4215)
- Simplify duplicated code by having one EnumFiles() function using callbacks to perform actual action on enumerated files. PrintAttribute() and ChangeAttribute() duplicate their functionality, except for the actual difference of displaying the file attributes vs. changing them. Instead, move that per-file action into two callbacks, create a file enumerator function that contains the common functionality, and make it call the callback passed in parameter to it. - Reparse points can be encountered during enumeration. In this case, don't try to go into too many reparse-point levels (maximum two). - Verify that paths/file names concatenation don't overflow (with the StringCch* functions returning an error), as this could cause an infinite loop in case of recursive-enumeration, and the position where the new path part would be appended turns out to be just at the end of the buffer.
1 parent e6c2336 commit ec0cc84

File tree

1 file changed

+237
-218
lines changed
  • base/applications/cmdutils/attrib

1 file changed

+237
-218
lines changed

0 commit comments

Comments
 (0)