Guard lower close_range call with fd > 3 in os_exec_script
Some checks failed
Build / build-mac (push) Has been cancelled
Build / build-linux (push) Has been cancelled
Build / build-win (push) Has been cancelled
CodeQL Advanced / Analyze (c-cpp) (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled

This commit is contained in:
Andrea Mazzoleni 2026-08-06 23:18:12 +02:00
parent 588b670572
commit dec765f8ac

View file

@ -839,7 +839,8 @@ int os_script(char** argv, char** envp, const char* run_as_user)
* *
* For scripts we cannot set fd as CLOEXEC. * For scripts we cannot set fd as CLOEXEC.
*/ */
close_range(3, fd - 1, CLOSE_RANGE_CLOEXEC); if (fd > 3)
close_range(3, fd - 1, CLOSE_RANGE_CLOEXEC);
close_range(fd + 1, ~0U, CLOSE_RANGE_CLOEXEC); close_range(fd + 1, ~0U, CLOSE_RANGE_CLOEXEC);
#endif #endif