summaryrefslogtreecommitdiff
path: root/main/channel.c
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2010-05-04 23:51:52 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2010-05-04 23:51:52 +0000
commit6a0ea1d79eaab5ad74bea55ace9e6ff9405a7afa (patch)
tree5f7ca7e27cab0cb761b00a35ca06b91063aa50eb /main/channel.c
parentfc652b869af90329d6c1441c4fdf9f9584d3fc7e (diff)
Merged revisions 261093-261094 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r261093 | tilghman | 2010-05-04 18:36:53 -0500 (Tue, 04 May 2010) | 7 lines Protect against overflow, when calculating how long to wait for a frame. (closes issue #17128) Reported by: under Patches: d.diff uploaded by under (license 914) ........ r261094 | tilghman | 2010-05-04 18:47:08 -0500 (Tue, 04 May 2010) | 2 lines Add a tiny corner case to the previous commit ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@261095 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/channel.c')
-rw-r--r--main/channel.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/main/channel.c b/main/channel.c
index ca6cdf89b..c91d60219 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -2630,10 +2630,15 @@ struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds,
}
/* Wait full interval */
rms = *ms;
- if (!ast_tvzero(whentohangup)) {
+ /* INT_MAX, not LONG_MAX, because it matters on 64-bit */
+ if (!ast_tvzero(whentohangup) && whentohangup.tv_sec < INT_MAX / 1000) {
rms = whentohangup.tv_sec * 1000 + whentohangup.tv_usec / 1000; /* timeout in milliseconds */
- if (*ms >= 0 && *ms < rms) /* original *ms still smaller */
+ if (*ms >= 0 && *ms < rms) { /* original *ms still smaller */
rms = *ms;
+ }
+ } else if (!ast_tvzero(whentohangup) && rms < 0) {
+ /* Tiny corner case... call would need to last >24 days */
+ rms = INT_MAX;
}
/*
* Build the pollfd array, putting the channels' fds first,