[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Mon Feb 28 13:11:02 MST 2011


The branch, master has been updated
       via  6e66208 Finish the range checking on all FD_SET calls for select().
      from  26321c6 s3-torture: fix the build of rpc_open_tcp.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 6e66208f6320949ba740e8d939fcfbb259ab0c67
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Feb 28 11:23:53 2011 -0800

    Finish the range checking on all FD_SET calls for select().
    
    Autobuild-User: Jeremy Allison <jra at samba.org>
    Autobuild-Date: Mon Feb 28 21:10:08 CET 2011 on sn-devel-104

-----------------------------------------------------------------------

Summary of changes:
 lib/tevent/tevent_select.c   |   10 ++++++++++
 lib/tevent/tevent_standard.c |    4 ++++
 2 files changed, 14 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/tevent/tevent_select.c b/lib/tevent/tevent_select.c
index 8cc6d06..94faa86 100644
--- a/lib/tevent/tevent_select.c
+++ b/lib/tevent/tevent_select.c
@@ -111,6 +111,11 @@ static struct tevent_fd *select_event_add_fd(struct tevent_context *ev, TALLOC_C
 							   struct select_event_context);
 	struct tevent_fd *fde;
 
+	if (fd < 0 || fd >= FD_SETSIZE) {
+		errno = EBADF;
+		return NULL;
+	}
+
 	fde = tevent_common_add_fd(ev, mem_ctx, fd, flags,
 				   handler, private_data,
 				   handler_name, location);
@@ -144,6 +149,11 @@ static int select_event_loop_select(struct select_event_context *select_ev, stru
 
 	/* setup any fd events */
 	for (fde = select_ev->ev->fd_events; fde; fde = fde->next) {
+		if (fde->fd < 0 || fde->fd >= FD_SETSIZE) {
+			errno = EBADF;
+			return -1;
+		}
+
 		if (fde->flags & TEVENT_FD_READ) {
 			FD_SET(fde->fd, &r_fds);
 		}
diff --git a/lib/tevent/tevent_standard.c b/lib/tevent/tevent_standard.c
index a68a03c..35f7ded 100644
--- a/lib/tevent/tevent_standard.c
+++ b/lib/tevent/tevent_standard.c
@@ -457,6 +457,10 @@ static int std_event_loop_select(struct std_event_context *std_ev, struct timeva
 
 	/* setup any fd events */
 	for (fde = std_ev->ev->fd_events; fde; fde = fde->next) {
+		if (fde->fd < 0 || fde->fd >= FD_SETSIZE) {
+			std_ev->exit_code = EBADF;
+			return -1;
+		}
 		if (fde->flags & TEVENT_FD_READ) {
 			FD_SET(fde->fd, &r_fds);
 		}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list