diff options
author | B. Stack <bgstack15@gmail.com> | 2023-07-24 15:08:16 -0400 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2023-07-24 15:08:16 -0400 |
commit | 69e12f5bd10459ff7c239b82519107ae2a755bc0 (patch) | |
tree | 8b22393241df7e46686c9426140582bd747a6d5a /zen/symlink_target.h | |
parent | add upstream 12.4 (diff) | |
download | FreeFileSync-69e12f5bd10459ff7c239b82519107ae2a755bc0.tar.gz FreeFileSync-69e12f5bd10459ff7c239b82519107ae2a755bc0.tar.bz2 FreeFileSync-69e12f5bd10459ff7c239b82519107ae2a755bc0.zip |
add upstream 12.5
Diffstat (limited to 'zen/symlink_target.h')
-rw-r--r-- | zen/symlink_target.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/zen/symlink_target.h b/zen/symlink_target.h index 8580a9dd..24ce2313 100644 --- a/zen/symlink_target.h +++ b/zen/symlink_target.h @@ -50,7 +50,10 @@ SymlinkRawContent getSymlinkRawContent_impl(const Zstring& linkPath) //throw Sys const ssize_t bytesWritten = ::readlink(linkPath.c_str(), buf.data(), bufSize); if (bytesWritten < 0) THROW_LAST_SYS_ERROR("readlink"); - if (makeUnsigned(bytesWritten) >= bufSize) //detect truncation; not an error for readlink! + + ASSERT_SYSERROR(makeUnsigned(bytesWritten) <= bufSize); //better safe than sorry + + if (makeUnsigned(bytesWritten) == bufSize) //detect truncation; not an error for readlink! throw SysError(formatSystemError("readlink", L"", L"Buffer truncated.")); return {.targetPath = Zstring(buf.data(), bytesWritten)}; //readlink does not append 0-termination! |