Prevent crash in 'sip show peers' when the number of peers on a system is large
authorMatthew Jordan <mjordan@digium.com>
Wed, 1 May 2013 18:38:40 +0000 (18:38 +0000)
committerMatthew Jordan <mjordan@digium.com>
Wed, 1 May 2013 18:38:40 +0000 (18:38 +0000)
commitb693a723780470ba654e5c6a1588299d82b34e35
treea69c0a28aef63d427157f57ca59b02fc30d1152a
parent3a5a0f3f26fb0d25fc956349770499e5a5d061a7
Prevent crash in 'sip show peers' when the number of peers on a system is large

When you have lots of SIP peers (according to the issue reporter, around 3500),
the 'sip show peers' CLI command or AMI action can crash due to a poorly placed
string duplication that occurs on the stack. This patch refactors the command
to not allocate the string on the stack, and handles the formatting of a single
peer in a separate function call.

(closes issue ASTERISK-21466)
Reported by: Guillaume Knispel
patches:
  fix_sip_show_peers_stack_overflow_asterisk_11.3.0-v2.patch uploaded by gknispel (License 6492)
........

Merged revisions 387134 from http://svn.asterisk.org/svn/asterisk/branches/11

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