mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: musl@lists.openwall.com
Subject: [musl] insufficient checking in posix_spawn_file_actions_addclose
Date: Mon, 25 Jan 2021 09:40:23 +0100	[thread overview]
Message-ID: <11940511.InkjXumKWH@omega> (raw)
In-Reply-To: <3521697.b4TYcCAa2N@omega>

Similarly, POSIX [1] says:
"The posix_spawn_file_actions_addclose() function shall fail if:

[EBADF]
    The value specified by fildes is negative."

However, in musl libc 1.2.2, this test program exits with status 2:
========================================================================
#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_addclose (&actions, -5) == 0)
    return 2;
  return 0;
}
========================================================================

Best regards,

          Bruno

[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn_file_actions_addclose.html


  reply	other threads:[~2021-01-25  8:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25  8:31 [musl] insufficient checking in posix_spawn_file_actions_add{open,dup2} Bruno Haible
2021-01-25  8:40 ` Bruno Haible [this message]
2021-01-25 14:42 ` Rich Felker
2021-01-25 16:07   ` Bruno Haible
2021-01-25 16:15     ` Rich Felker
2021-01-25 17:58       ` Bruno Haible
2021-01-25 19:33       ` Alexey Izbyshev
2021-01-25 19:37       ` Markus Wichmann
2021-01-25 19:48         ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11940511.InkjXumKWH@omega \
    --to=bruno@clisp.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).