summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2015-11-06 11:36:06 +0000
committerNanang Izzuddin <nanang@teluu.com>2015-11-06 11:36:06 +0000
commit64dc32039dc1b9e051c1e059a04e6c84b60b1392 (patch)
tree64cf502af9367e9bc06ee7c6ec84a050227ec05a
parent7b45816ef7ad5aa0784b2e0aa48056309cce594f (diff)
Re #1894: Fixed high socket descriptor check in ioqueue select, it should be against FD_SETSIZE instead of PJ_IOQUEUE_MAX_HANDLES, as PJ_IOQUEUE_MAX_HANDLES can be lower than FD_SETSIZE.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5196 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjlib/src/pj/ioqueue_select.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/pjlib/src/pj/ioqueue_select.c b/pjlib/src/pj/ioqueue_select.c
index a0c964b6..8dd01720 100644
--- a/pjlib/src/pj/ioqueue_select.c
+++ b/pjlib/src/pj/ioqueue_select.c
@@ -338,8 +338,12 @@ PJ_DEF(pj_status_t) pj_ioqueue_register_sock2(pj_pool_t *pool,
* avoid potential memory corruption caused by select() when given
* an fd that is higher than FD_SETSIZE.
*/
- if (sizeof(fd_set) < FD_SETSIZE && sock >= PJ_IOQUEUE_MAX_HANDLES)
- return PJ_ETOOBIG;
+ if (sizeof(fd_set) < FD_SETSIZE && sock >= FD_SETSIZE) {
+ PJ_LOG(4, ("pjlib", "Failed to register socket to ioqueue because "
+ "socket fd is too big (fd=%d/FD_SETSIZE=%d)",
+ sock, FD_SETSIZE));
+ return PJ_ETOOBIG;
+ }
pj_lock_acquire(ioqueue->lock);