[Bug libstdc++/104161] Potential Security Vulnerability: remove_all and symbolic link

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jan 26 00:30:14 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104161

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This reduces the scope of the problem, but if the directory is replaced with a
symlink *after* constructing the directory_iterator then filesystem::remove can
still remove the wrong things.

We really need to unlinkat, using a file descriptor obtained from dirfd on the
iterator's DIR*.


More information about the Gcc-bugs mailing list