[Asterisk-code-review] logger.c: Fix buffer overrun found by address sanitizer. (asterisk[13])

Matt Jordan asteriskteam at digium.com
Fri Jan 22 14:57:53 CST 2016


Matt Jordan has submitted this change and it was merged.

Change subject: logger.c: Fix buffer overrun found by address sanitizer.
......................................................................


logger.c: Fix buffer overrun found by address sanitizer.

The null terminator of the tail struct member was not being allocated
when no logger.conf config file is installed.

ASTERISK-25714 #close
Reported by: Badalian Vyacheslav

Change-Id: I45770fdd08af39506a3bc33ba279c4f16e047a30
---
M main/logger.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Matt Jordan: Looks good to me, approved



diff --git a/main/logger.c b/main/logger.c
index fb9e8ed..46d9cbb 100644
--- a/main/logger.c
+++ b/main/logger.c
@@ -464,7 +464,7 @@
 
 	/* If no config file, we're fine, set default options. */
 	if (!cfg) {
-		if (!(chan = ast_calloc(1, sizeof(*chan)))) {
+		if (!(chan = ast_calloc(1, sizeof(*chan) + 1))) {
 			fprintf(stderr, "Failed to initialize default logging\n");
 			return -1;
 		}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I45770fdd08af39506a3bc33ba279c4f16e047a30
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-code-review mailing list