mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 06:38:10 +00:00
![]() The realpath syscall can attempt to return arbitrarily long paths, in particular paths that are longer than PATH_MAX. The only way to detect this case is checking whether 'rc', the true length of the returned path including NUL byte, exceeds our buffer length. In such a case, the buffer contains invalid data. All Serenity code calls LibC's realpath() with a nullptr buffer, meaning that realpath is supposed to allocate memory on its own. All Serenity code can handle arbitrarily long paths returned by LibC's realpath, so it is safe to "do the dance" and repeat the syscall with a new buffer. Ports are likely to be graceful in this regard, too. If a Port calls realpath() with a pre-allocated buffer, however, there is nothing better we can do than return a truncated buffer. |
||
---|---|---|
.. | ||
Applications | ||
Demos | ||
DevTools | ||
DynamicLoader | ||
Games | ||
Libraries | ||
MenuApplets | ||
Services | ||
Shell | ||
Tests | ||
Utilities | ||
CMakeLists.txt |