From: Russell Bryant Date: Wed, 3 Sep 2008 13:24:35 +0000 (+0000) Subject: Don't freak out if the poll emulation receives NULL for the pollfds array X-Git-Tag: 1.4.22~21 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cb07ce5fa06107a5b339e17b02571a880fd69915;p=thirdparty%2Fasterisk.git Don't freak out if the poll emulation receives NULL for the pollfds array (closes issue #13307) Reported by: jcovert git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@140816 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/poll.c b/main/poll.c index bd283866d4..c053ba0150 100644 --- a/main/poll.c +++ b/main/poll.c @@ -273,19 +273,19 @@ int poll fd_set except_descs; /* exception descs */ struct timeval stime; /* select() timeout value */ int ready_descriptors; /* function result */ - int max_fd; /* maximum fd value */ + int max_fd = 0; /* maximum fd value */ struct timeval *pTimeout; /* actually passed */ FD_ZERO (&read_descs); FD_ZERO (&write_descs); FD_ZERO (&except_descs); - assert (pArray != (struct pollfd *) NULL); - /* Map the poll() file descriptor list in the select() data structures. */ - max_fd = map_poll_spec (pArray, n_fds, - &read_descs, &write_descs, &except_descs); + if (pArray) { + max_fd = map_poll_spec (pArray, n_fds, + &read_descs, &write_descs, &except_descs); + } /* Map the poll() timeout value in the select() timeout structure. */