mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] fdopen() doesn't check for valid fd
@ 2021-02-26 17:36 Dominic Chen
  2021-02-26 18:00 ` Rich Felker
  0 siblings, 1 reply; 5+ messages in thread
From: Dominic Chen @ 2021-02-26 17:36 UTC (permalink / raw)
  To: musl

I've been verifying the behavior of an application between glibc and 
musl, and have noticed that the musl implementation of fdopen() assumes 
that the input fd is valid, whereas glibc does not. Per 
https://pubs.opengroup.org/onlinepubs/9699919799/, it seems that 
fdopen() is allowed to fail with EBADF, so inside __fdopen(), the 
syscalls to SYS_fcntl and SYS_ioctl should probably check for an error, 
deallocate the FILE *, and return nullptr.

Thanks,

Dominic




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-02-27 17:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-26 17:36 [musl] fdopen() doesn't check for valid fd Dominic Chen
2021-02-26 18:00 ` Rich Felker
2021-02-27 17:13   ` Khem Raj
2021-02-27 17:35     ` Rich Felker
2021-02-27 17:42       ` Khem Raj

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).