diff options
author | Joshua Colp <jcolp@digium.com> | 2016-04-12 11:10:45 -0300 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2016-04-12 10:21:56 -0500 |
commit | daa086fae4bdbdc06b8ff5e47c4a6be85ee9ddbb (patch) | |
tree | 052ff47fd74e645df5f55dd65be54d6e99cbbe85 /apps | |
parent | 70c788ec5e9c3ae4ee66ee05541c486849e103dc (diff) |
app_voicemail: Fix test_voicemail_notify_endl test.
The test_voicemail_notify_endl test checks the end-of-line
characters of an email message to confirm that they are consistent.
The test wrongfully assumed that reading from the email message
into a buffer will always result in more than 1 character being
read. This is incorrect. If only 1 character was read the test
would go outside of the buffer and access other memory causing
a crash.
The test now checks to ensure that 2 or more characters are read
in ensuring the test stays within the buffer.
ASTERISK-25874 #close
Change-Id: Ic2c89cea6e90f2c0bc2d8138306ebbffd4f8b710
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_voicemail.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index ce99cc9eb..798f844fa 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -14456,11 +14456,13 @@ AST_TEST_DEFINE(test_voicemail_notify_endl) rewind(file); while (fgets(buf, sizeof(buf), file)) { if ( + (strlen(buf) > 1 && #ifdef IMAP_STORAGE buf[strlen(buf) - 2] != '\r' #else buf[strlen(buf) - 2] == '\r' #endif + ) || buf[strlen(buf) - 1] != '\n') { res = AST_TEST_FAIL; } |