diff options
| author | Saikari <[email protected]> | 2026-07-10 05:01:39 +0300 |
|---|---|---|
| committer | Saikari <[email protected]> | 2026-07-10 05:01:39 +0300 |
| commit | 2567b4e41ba9b0f508e34e307b5816045d15e3b4 (patch) | |
| tree | aa1c2c96907861165faa77d7b2745d1798eb605b /xmake/modules | |
| parent | 3a0b131873815ff3c2d4d133885f1e691823e945 (diff) | |
fix: avoid stack buffer overflow for long paths in path translation
Diffstat (limited to 'xmake/modules')
| -rw-r--r-- | xmake/modules/private/service/remote_build/filesync.lua | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/xmake/modules/private/service/remote_build/filesync.lua b/xmake/modules/private/service/remote_build/filesync.lua index fa9ba1fde..d2c2d6703 100644 --- a/xmake/modules/private/service/remote_build/filesync.lua +++ b/xmake/modules/private/service/remote_build/filesync.lua @@ -89,7 +89,10 @@ function filesync:snapshot() ignorefiles = "|" .. table.concat(ignorefiles, "|") end local count = 0 - for _, filepath in ipairs(os.files(path.join(rootdir, "**" .. ignorefiles))) do + -- we should not translate the whole pattern with ignorefiles in path.join, + -- because the joined pattern string may be very long (> TB_PATH_MAXN) + -- https://github.com/xmake-io/xmake/issues/6962 + for _, filepath in ipairs(os.files(path.join(rootdir, "**") .. ignorefiles)) do local fileitem = path.relative(filepath, rootdir) if fileitem then -- we should always use '/' in path key for supporting linux & windows |
