]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: istream-file - Ensure fd is in valid range
authorAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 27 May 2019 09:56:29 +0000 (12:56 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Tue, 28 May 2019 07:52:42 +0000 (10:52 +0300)
src/lib/istream-file.c

index 1836169674ed9c668bc16cec2a1abeb7e05e6ac3..9989eaac0283354012306bc1dcd1e2cc87bb0f92 100644 (file)
@@ -221,6 +221,7 @@ i_stream_create_file_common(struct file_istream *fstream,
                fstream->istream.istream.blocking = TRUE;
                fstream->istream.istream.seekable = TRUE;
        } else if ((flags = fcntl(fd, F_GETFL, 0)) < 0) {
+               i_assert(fd > -1);
                /* shouldn't happen */
                fstream->istream.istream.stream_errno = errno;
                io_stream_set_error(&fstream->istream.iostream,