summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2009-06-25 12:31:52 +0000
committerBenny Prijono <bennylp@teluu.com>2009-06-25 12:31:52 +0000
commitccf262afd80933548c06aa028400cad0c6993579 (patch)
tree07c45aad7ba50fc298a8953e1a564518a1ad2e2f
parentece0a57585214b287641b00ae733494c47ded951 (diff)
Ticket #770: Bug in select ioqueue: event counter may exceed maximum value, causing stack corruption (thanks Joel Dodson for the report)
- backported changes in #769 git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.0@2806 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjlib/src/pj/ioqueue_select.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/pjlib/src/pj/ioqueue_select.c b/pjlib/src/pj/ioqueue_select.c
index 51d0eb5d..d4f93728 100644
--- a/pjlib/src/pj/ioqueue_select.c
+++ b/pjlib/src/pj/ioqueue_select.c
@@ -727,7 +727,8 @@ PJ_DEF(int) pj_ioqueue_poll( pj_ioqueue_t *ioqueue, const pj_time_val *timeout)
/* Scan for readable socket. */
if ((key_has_pending_read(h) || key_has_pending_accept(h))
- && PJ_FD_ISSET(h->fd, &rfdset) && !IS_CLOSING(h))
+ && PJ_FD_ISSET(h->fd, &rfdset) && !IS_CLOSING(h) &&
+ counter<count)
{
#if PJ_IOQUEUE_HAS_SAFE_UNREG
increment_counter(h);
@@ -739,7 +740,7 @@ PJ_DEF(int) pj_ioqueue_poll( pj_ioqueue_t *ioqueue, const pj_time_val *timeout)
#if PJ_HAS_TCP
if (key_has_pending_connect(h) && PJ_FD_ISSET(h->fd, &xfdset) &&
- !IS_CLOSING(h))
+ !IS_CLOSING(h) && counter<count)
{
#if PJ_IOQUEUE_HAS_SAFE_UNREG
increment_counter(h);