app_voicemail/IMAP: IMAP access FATAL error: Out of memory
authorAlexei Gradinari <alex2grad@gmail.com>
Thu, 7 Apr 2016 16:37:43 +0000 (12:37 -0400)
committerJoshua Colp <jcolp@digium.com>
Fri, 8 Apr 2016 18:04:02 +0000 (13:04 -0500)
commitf9dab808165bdbda3dbc2dd0ae07c462abfc8162
treef9148ddcd161a3b629569747c461a3273dd82b11
parentb47dfd1c6ead5c8783660465af997a4360555ea1
app_voicemail/IMAP: IMAP access FATAL error: Out of memory

Sometimes uw-imap function 'mail_fetchbody' returns huge len
which then pass to uw-imap function 'rfc822_base64'.
uw-imap tries to allocate huge memory and abort() on fail.

This patch check the len.
If the len more than max size (128 Mbytes) log error.
This patch also set variables len, newlen to avoid uninizialezed len.
This patch also check pointer returned by rfc822_base64.

ASTERISK-25899 #close

Change-Id: I4a0e7d655f11abef6a5224e2169df6d5c1f1caca
apps/app_voicemail.c