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

Richard Mudgett asteriskteam at digium.com
Fri Jan 22 12:35:57 CST 2016


Richard Mudgett has uploaded a new change for review.

  https://gerrit.asterisk.org/2068

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(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/68/2068/1

diff --git a/main/logger.c b/main/logger.c
index fac68d9..13f6de8 100644
--- a/main/logger.c
+++ b/main/logger.c
@@ -601,7 +601,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/2068
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I45770fdd08af39506a3bc33ba279c4f16e047a30
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list