[Pkg-gnupg-commit] [gpgme] 167/412: core: Make sure FD_SET is not used with an out of range fd.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Sep 22 21:26:40 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gpgme.

commit 8173c4f1f8a145c4b1d454f6f05e26950e23d675
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Jun 14 08:35:12 2016 +0200

    core: Make sure FD_SET is not used with an out of range fd.
    
    * src/posix-io.c (_gpgme_io_select): Check for FD out of range.
    --
    
    Signed-off-by: Werner Koch <wk at gnupg.org>
---
 src/posix-io.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/posix-io.c b/src/posix-io.c
index f336153..258e8ea 100644
--- a/src/posix-io.c
+++ b/src/posix-io.c
@@ -604,6 +604,12 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock)
 	continue;
       if (fds[i].for_read)
 	{
+          if (fds[i].fd >= FD_SETSIZE)
+            {
+              TRACE_END (dbg_help, " -BAD- ]");
+              gpg_err_set_errno (EBADF);
+              return TRACE_SYSRES (-1);
+            }
 	  assert (!FD_ISSET (fds[i].fd, &readfds));
 	  FD_SET (fds[i].fd, &readfds);
 	  if (fds[i].fd > max_fd)
@@ -613,6 +619,12 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock)
         }
       else if (fds[i].for_write)
 	{
+          if (fds[i].fd >= FD_SETSIZE)
+            {
+              TRACE_END (dbg_help, " -BAD- ]");
+              gpg_err_set_errno (EBADF);
+              return TRACE_SYSRES (-1);
+            }
 	  assert (!FD_ISSET (fds[i].fd, &writefds));
 	  FD_SET (fds[i].fd, &writefds);
 	  if (fds[i].fd > max_fd)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gpgme.git



More information about the Pkg-gnupg-commit mailing list