]> git.ipfire.org Git - thirdparty/asterisk.git/commit
Fix places in resources where a negative return value could impact execution
authorMatthew Jordan <mjordan@digium.com>
Tue, 17 Apr 2012 21:11:25 +0000 (21:11 +0000)
committerMatthew Jordan <mjordan@digium.com>
Tue, 17 Apr 2012 21:11:25 +0000 (21:11 +0000)
commita3a5fee8a1b10b835ba0c416a077c13fe44688c3
tree3adad0d69b5b67fb46fb91719f8c160d2074828b
parentecb1323ef1ae52d6e314d6d7356e528b518408be
Fix places in resources where a negative return value could impact execution

This patch addresses a number of modules in resources that did not handle the
negative return value from function calls adequately.  This includes:

* res_agi.c: if the result of the read function is a negative number,
indicating some failure, the result would instead be treated as the number
of bytes read.  This patch now treats negative results in the same manner
as an end of file condition, with the exception that it also logs the
error code indicated by the return.

* res_musiconhold.c: if spawn_mp3 fails to assign a file descriptor to srcfd,
and instead assigns a negative value, that file descriptor could later be
passed to functions that require a valid file descriptor.  If spawn_mp3 fails,
we now immediately retry instead of continuing in the logic.

* res_rtp_asterisk.c: if no codec can be matched between two RTP instances
in a peer to peer bridge, we immediately return instead of attempting to
use the codec payload type as an index to determine the appropriate negotiated
codec.

(issue ASTERISK-19655)
Reported by: Matt Jordan

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

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@362364 65c4cc65-6c06-0410-ace0-fbb531ad65f3
res/res_agi.c
res/res_musiconhold.c
res/res_rtp_asterisk.c