|
Message-ID: <3521697.b4TYcCAa2N@omega> Date: Mon, 25 Jan 2021 09:31:50 +0100 From: Bruno Haible <bruno@...sp.org> To: musl@...ts.openwall.com Subject: insufficient checking in posix_spawn_file_actions_add{open,dup2} Hi, POSIX [1][2] says about the functions posix_spawn_file_actions_addopen posix_spawn_file_actions_adddup2 The function "shall fail if: [EBADF] The value specified by fildes is negative or greater than or equal to {OPEN_MAX}." However, in musl libc 1.2.2, these two test programs exit with status 2: ======================================================================== #include <spawn.h> #include <fcntl.h> int main () { posix_spawn_file_actions_t actions; if (posix_spawn_file_actions_init (&actions) != 0) return 1; if (posix_spawn_file_actions_addopen (&actions, 10000000, "foo", 0, O_RDONLY) == 0) return 2; return 0; } ======================================================================== #include <spawn.h> int main () { posix_spawn_file_actions_t actions; if (posix_spawn_file_actions_init (&actions) != 0) return 1; if (posix_spawn_file_actions_adddup2 (&actions, 10000000, 2) == 0) return 2; return 0; } ======================================================================== sysconf (_SC_OPEN_MAX) is 1024, on that system. Best regards, Bruno [1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn_file_actions_addopen.html [2] https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn_file_actions_adddup2.html
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.