Boost C++ Libraries: Ticket #13133: copy_file does not check file type, can fill disk or hang program if used on certain file types https://svn.boost.org/trac10/ticket/13133 <p> Boost’s copy_file method, when passed non-regular files, can fill up the user’s disk space or hang the program. </p> <p> The copy_file method does not check file type before it begins copying, which can lead to unspecified behavior if the user tries to copy a non-regular (type) file. As only regular files can be properly copied by reading and writing their contents, trying to copy non-regular files in this way can cause problems. For example: </p> <ul><li>Trying to copy a symlink to the character device /dev/urandom with copy_file will copy random data into the output file indefinitely, quickly filling up the user’s disk. </li><li>Trying to copy a FIFO type file with copy_file will result in the program hanging indefinitely if left unattended. </li></ul><p> This problem can be fixed without too much work by checking the result of the post-open stat call to check that a regular file was opened. I have written up a patch, which I submitted a pull-request for (<a class="closed ticket" href="https://svn.boost.org/trac10/ticket/48" title="#48: Tasks: Steal PWD from Matt Armstrong (closed: Fixed)">#48</a>). This problem was found as part of an effort to detect and deal with “environmental” bugs in popular applications (for more information, check out <a class="ext-link" href="https://works-everywhere.org"><span class="icon">​</span>https://works-everywhere.org</a>). It was found using a tool that detects situations where an application fails to correctly handle unusual environmental conditions such as files having an unexpected file type. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13133 Trac 1.4.3