[asterisk-commits] app voicemail: Fix test voicemail notify endl test. (asterisk[11])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 12 20:28:08 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: app_voicemail: Fix test_voicemail_notify_endl test.
......................................................................


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
---
M apps/app_voicemail.c
1 file changed, 2 insertions(+), 0 deletions(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 0911ecc..7f65fd7 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -14077,11 +14077,13 @@
 		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;
 			}

-- 
To view, visit https://gerrit.asterisk.org/2575
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic2c89cea6e90f2c0bc2d8138306ebbffd4f8b710
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 11
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-commits mailing list