]> git.ipfire.org Git - thirdparty/asterisk.git/commit
Merged revisions 356214 via svnmerge from
authorMatthew Jordan <mjordan@digium.com>
Wed, 22 Feb 2012 14:53:53 +0000 (14:53 +0000)
committerMatthew Jordan <mjordan@digium.com>
Wed, 22 Feb 2012 14:53:53 +0000 (14:53 +0000)
commitbc3cb5ddbc0e2f276a3cd404f2dfa3e0250247d0
tree5a29341e165d6cda8041e8cf0f90984c412bf0c7
parent34179f70937a9a78da896670ad9d3767f6e5ed8c
Merged revisions 356214 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r356214 | mjordan | 2012-02-22 08:50:20 -0600 (Wed, 22 Feb 2012) | 27 lines

  Fix potential buffer overrun and memory leak when executing "sip show peers"

  The "sip show peers" command uses a fix sized array to sort the current peers
  in the peers ao2_container.  The size of the array is based on the current
  number of peers in the container.  However, once the size of the array is
  determined, the number of peers in the container can change, as the peers
  container is not locked.  This could cause a buffer overrun when populating
  the array, if peers were added to the container after the array was created.
  Additionally, a memory leak of the allocated array would occur if a user
  caused the _show_peers method to return CLI_SHOWUSAGE.

  We now create a snapshot of the current peers using an ao2_callback with the
  OBJ_MULTIPLE flag.  This size of the array is set to the number of peers
  that the iterator will iterate over; hence, if peers are added or removed
  from the peers container it will not affect the execution of the "sip show
  peers" command.

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

  (closes issue ASTERISK-19231)
  (closes issue ASTERISK-19361)
  Reported by: Thomas Arimont, Jamuel Starkey
  Tested by: Thomas Arimont, Jamuel Starkey
  Patches: sip_show_peers_2012_02_16.diff uploaded by mjordan (license 6283)
........

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