]> git.ipfire.org Git - thirdparty/asterisk.git/commit
apps/app_voicemail: Fix crash with IMAP when streams are opened simultaneously
authorMatthew Jordan <mjordan@digium.com>
Wed, 3 Dec 2014 16:45:08 +0000 (16:45 +0000)
committerMatthew Jordan <mjordan@digium.com>
Wed, 3 Dec 2014 16:45:08 +0000 (16:45 +0000)
commitbda506c346143eecc171da0f5d3cd684481b0b90
tree9e259c2346c80076c4aecd591e7edbc5e1fcb4d6
parent9a5442cf99f59acfeb835ba507ef5e070f32c1ea
apps/app_voicemail: Fix crash with IMAP when streams are opened simultaneously

The UW IMAP library is instrinsically not thread-safe, and relies upon higher
level applications to guarantee thread safety. For the most part, this is
provided by the vms object, which provides locking for individual streams.
Unfortunately, this is not sufficient for calls to mail_open which create the
IMAP stream. mail_open can, on some systems, call into a UW IMAP specific
function for determining the address of a system based on a hostname,
ip_nametoaddr.

In the ip6_unix implementation of this function, static variables are used
to hold parsing buffers. This can cause a crash if multiple threads attempt
to convert a hostname to an address at the same time. Locking on a single
mail stream is not sufficient to prevent simultaneous access to these static
variables.

In the IMAP library, this function can be called from the mail_open and
imap_status functions. As the imap_status function is not used by
app_voicemail, locking on access to mail_open is sufficient to prevent
any mangling of the buffers.

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

ASTERISK-24516 #close
Reported by: David Duncan Ross Palmer
Tested by: David Duncan Ross Palmer
patches:
  ASTERISK-24516.diff uploaded by David Duncan Ross Palmer (License 6660)
........

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

Merged revisions 428864 from http://svn.asterisk.org/svn/asterisk/branches/12

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@428865 65c4cc65-6c06-0410-ace0-fbb531ad65f3
apps/app_voicemail.c