diff options
author | Yusuke Endoh <[email protected]> | 2019-10-13 00:49:18 +0900 |
---|---|---|
committer | Yusuke Endoh <[email protected]> | 2019-10-13 00:49:18 +0900 |
commit | 90b9900dc159efb63feee9b0995cc5d56aef6d75 (patch) | |
tree | 231a9103970e83b969b4ac135a5acfb83e62b27f /io.c | |
parent | ebc2198d9f0292fee97e623b5e2a545fccb91d2a (diff) |
io.c (rb_update_max_fd): fail with a negative file descripter
Coverity Scan points out that ext/socket/unixsocket.c may pass -1 to
rb_update_max_fd. I'm unsure whether it can happen actually or not, but
it would be good for the function to reject a negative value.
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -201,7 +201,7 @@ rb_update_max_fd(int fd) rb_atomic_t max_fd = max_file_descriptor; int err; - if (afd <= max_fd) + if (fd < 0 || afd <= max_fd) return; #if defined(HAVE_FCNTL) && defined(F_GETFL) |