summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Clarke <jrtc27@jrtc27.com>2016-04-25 17:12:08 +0100
committerAdam Jackson <ajax@redhat.com>2016-05-02 10:09:50 -0400
commitde30673937e2d36b84cf50c3eb05bbf9836fabfb (patch)
treee90d8baf56fbab3d4728a3be2f0680737b17869f
parentedc04f87c74abacb57782dc947f81a2810a72537 (diff)
downloadxorg-proto-x11proto-de30673937e2d36b84cf50c3eb05bbf9836fabfb.tar.gz
Don't let XFD_SETSIZE exceed FD_SETSIZE
This fixes 2c94cdb453bc641246cc8b9a876da9799bee1ce7 on the Hurd, as FD_SETSIZE is only 256, and so anyone using XFD_SETSIZE to iterate over the contents of an fd_set will overrun the array. Signed-off-by: James Clarke <jrtc27@jrtc27.com> Reviewed-by: Julien Cristau <jcristau@debian.org>
-rw-r--r--Xpoll.h.in11
1 files changed, 7 insertions, 4 deletions
diff --git a/Xpoll.h.in b/Xpoll.h.in
index 2878591..9f127e1 100644
--- a/Xpoll.h.in
+++ b/Xpoll.h.in
@@ -67,10 +67,13 @@ typedef long fd_mask;
# endif
#endif
-#define XFD_SETSIZE 512
-
-#ifndef FD_SETSIZE
-#define FD_SETSIZE XFD_SETSIZE
+#if defined(FD_SETSIZE) && FD_SETSIZE < 512
+# define XFD_SETSIZE FD_SETSIZE
+#else
+# define XFD_SETSIZE 512
+# ifndef FD_SETSIZE
+# define FD_SETSIZE XFD_SETSIZE
+# endif
#endif
#ifndef NBBY