reactos/base/applications/cmdutils/attrib
Hermès Bélusca-Maïto ec0cc847b9
[ATTRIB] De-duplicate code; handle reparse points; verify path concatenation (#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.
2023-08-11 13:49:27 +02:00
..
lang [ATTRIB] Reorganize resource file headers. 2023-05-17 19:40:43 +02:00
attrib.c [ATTRIB] De-duplicate code; handle reparse points; verify path concatenation (#4215) 2023-08-11 13:49:27 +02:00
attrib.rc [ATTRIB][CMD] Convert the 'attrib' command into a standalone executable 2019-09-21 11:41:15 +02:00
CMakeLists.txt [ATTRIB][CMD] Convert the 'attrib' command into a standalone executable 2019-09-21 11:41:15 +02:00
resource.h [CMDUTILS][ATTRIB] Support folder attributes (#2103) 2019-11-29 20:03:19 +09:00