Skip to content

Potential race condition in Poco::File on Windows #990

@quantumsteve

Description

@quantumsteve

I recently watched a CppCon talk where the speaker said that to delete a directory tree on Windows, one should first rename files to a random name in %TEMP%, then delete.

I noticed that Poco::File::remove(bool recursive) is using the same algorithm on both UNIX and Windows.

https://github.com/pocoproject/poco/blob/develop/Foundation/src/File.cpp#L262
https://github.com/pocoproject/poco/blob/develop/Foundation/src/File_UNIX.cpp#L368
https://github.com/pocoproject/poco/blob/develop/Foundation/src/File_WIN32.cpp#L305

The Windows algorithm should be changed to avoid this potential data race.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions