From 9ba5373f788958b61588203add314b8a9a5c4618 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Thu, 16 Feb 2012 10:28:53 +0900 Subject: Avoid too long timeouts in xs_poll The timeout should be int. For historical reasons, however, it is defined as long. To fix the problem the value is checked in the runtime to assure it is not larger than INT_MAX. Signed-off-by: Martin Sustrik --- src/upoll.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/upoll.cpp b/src/upoll.cpp index c4aa0a1..592cc42 100644 --- a/src/upoll.cpp +++ b/src/upoll.cpp @@ -56,10 +56,12 @@ #include #endif +#include + int xs::upoll (xs_pollitem_t *items_, int nitems_, long timeout_) { #if defined XS_POLL_BASED_ON_POLL - if (unlikely (nitems_ < 0)) { + if (unlikely (nitems_ < 0 || timeout_ > INT_MAX)) { errno = EINVAL; return -1; } -- cgit v1.2.3