diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-08-07 01:32:51 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-08-07 01:32:51 +0000 |
commit | 0ae26ab60cd8c757a23334423550f3bbf6bc1816 (patch) | |
tree | c615035689947f67e2db9267e2e83fad9045aaef | |
parent | d14a000502d4fcb60fbb8b29d8ec63ab6391097b (diff) |
Merged revisions 39081 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r39081 | russell | 2006-08-06 21:28:29 -0400 (Sun, 06 Aug 2006) | 7 lines
Fix a crash reported to me by hads on IRC. This crash would occur with the use
of the "distinctiveringaftercid" option. Also, on this user's system, the crash
would only occur when built without optimizations. This is because the bug is
that the code would write past the end of an array that was allocated on the
stack, and the structure of the stack is different with or without optimizations
enabled.
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@39082 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | channels/chan_zap.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c index 7863dfaa7..1c06a7ca1 100644 --- a/channels/chan_zap.c +++ b/channels/chan_zap.c @@ -765,8 +765,6 @@ static struct zt_ring_cadence cadences[NUM_CADENCE_MAX] = { { { 1000, 500, 2500, 5000 } }, /*!< Long ring */ }; -int receivedRingT; /*!< Used to find out what ringtone we are on */ - /*! \brief cidrings says in which pause to transmit the cid information, where the first pause * is 1, the second pause is 2 and so on. */ @@ -6135,9 +6133,8 @@ static void *ss_thread(void *data) len = 0; distMatches = 0; /* Clear the current ring data array so we dont have old data in it. */ - for (receivedRingT = 0; receivedRingT < 3; receivedRingT++) { + for (receivedRingT = 0; receivedRingT < (sizeof(curRingData) / sizeof(curRingData[0])); receivedRingT++) curRingData[receivedRingT] = 0; - } receivedRingT = 0; counter = 0; counter1 = 0; @@ -6165,8 +6162,10 @@ static void *ss_thread(void *data) if (p->ringt < p->ringt_base/2) break; - ++receivedRingT; /* Increment the ringT counter so we can match it against - values in zapata.conf for distinctive ring */ + /* Increment the ringT counter so we can match it against + values in zapata.conf for distinctive ring */ + if (++receivedRingT == (sizeof(curRingData) / sizeof(curRingData[0]))) + break; } else if (i & ZT_IOMUX_READ) { res = read(p->subs[index].zfd, buf, sizeof(buf)); if (res < 0) { @@ -6237,9 +6236,8 @@ static void *ss_thread(void *data) len = 0; distMatches = 0; /* Clear the current ring data array so we dont have old data in it. */ - for (receivedRingT = 0; receivedRingT < 3; receivedRingT++) { + for (receivedRingT = 0; receivedRingT < (sizeof(curRingData) / sizeof(curRingData[0])); receivedRingT++) curRingData[receivedRingT] = 0; - } receivedRingT = 0; counter = 0; counter1 = 0; @@ -6269,8 +6267,10 @@ static void *ss_thread(void *data) if (p->ringt < p->ringt_base/2) break; - ++receivedRingT; /* Increment the ringT counter so we can match it against - values in zapata.conf for distinctive ring */ + /* Increment the ringT counter so we can match it against + values in zapata.conf for distinctive ring */ + if (++receivedRingT == (sizeof(curRingData) / sizeof(curRingData[0]))) + break; } else if (i & ZT_IOMUX_READ) { res = read(p->subs[index].zfd, buf, sizeof(buf)); if (res < 0) { |