]> git.ipfire.org Git - thirdparty/asterisk.git/commit
Fix negative return handling in channel drivers
authorMatthew Jordan <mjordan@digium.com>
Mon, 16 Apr 2012 21:57:19 +0000 (21:57 +0000)
committerMatthew Jordan <mjordan@digium.com>
Mon, 16 Apr 2012 21:57:19 +0000 (21:57 +0000)
commit3c6ba6fa5a6942a9894ec169e6fd00523aa9684d
tree4d9fa29d2117f3b5f33b5c514bf69b087f7e7628
parent3f5ee40c6dc21314945074743bc8cf643bf35f96
Fix negative return handling in channel drivers

In chan_agent, while handling a channel indicate, the agent channel driver
must obtain a lock on both the agent channel, as well as the channel the
agent channel is using.  To do so, it attempts to lock the other channel
first, then unlock the agent channel which is locked prior to entry into
the indicate handler.  If this unlock fails with a negative return value,
which can occur if the object passed to agent_indicate is an invalid ao2
object or is NULL, the return value is passed directly to strerror, which
can only accept positive integer values.

In chan_dahdi, the return value of dahdi_get_index is used to directly
index into the sub-channel array.  If dahd_get_index returns a negative
value, it would use that value to index into the array, which could cause
an invalid memory access.  If dahdi_get_index returns a negative number,
we now default to SUB_REAL.

(issue ASTERISK-19655)
Reported by: Matt Jordan

Review: https://reviewboard.asterisk.org/r/1863/
........

Merged revisions 362204 from http://svn.asterisk.org/svn/asterisk/branches/1.8

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@362205 65c4cc65-6c06-0410-ace0-fbb531ad65f3
channels/chan_agent.c
channels/chan_dahdi.c