]> git.ipfire.org Git - thirdparty/asterisk.git/commit
Fix places in main where a negative return value could impact execution
authorMatthew Jordan <mjordan@digium.com>
Tue, 17 Apr 2012 21:00:10 +0000 (21:00 +0000)
committerMatthew Jordan <mjordan@digium.com>
Tue, 17 Apr 2012 21:00:10 +0000 (21:00 +0000)
commit0bdbd0d8993b2f3fb602ff662d767566f04a1262
treef59f682fd92c65fe58425504ddba5cc0d6a3bac7
parent2d7a927c8136f2bb36a46d000fde468adca003c9
Fix places in main where a negative return value could impact execution

This patch addresses a number of modules in main that did not handle the
negative return value from function calls adequately, or were not sufficiently
clear that the conditions leading to improper handling of the return values
could not occur.  This includes:

* asterisk.c: A negative return value from the read function would be used
directly as an index into a buffer.  We now check for success of the read
function prior to using its result as an index.

* manager.c: Check for failures in mkstemp and lseek when handling the
temporary file created for processing data returned from a CLI command in
action_command.  Also check that the result of an lseek is sanitized prior
to using it as the size of a memory map to allocate.

* translate.c: Note in the appropriate locations where powerof cannot return
a negative value, due to proper checks placed on the inputs to that function.

(issue ASTERISK-19655)
Reported by: Matt Jordan

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@362359 65c4cc65-6c06-0410-ace0-fbb531ad65f3
main/asterisk.c
main/manager.c
main/translate.c