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

Richard Mudgett asteriskteam at digium.com
Fri Jan 22 12:36:10 CST 2016


Richard Mudgett has uploaded a new change for review.

  https://gerrit.asterisk.org/2069

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/69/2069/1

diff --git a/main/logger.c b/main/logger.c
index 795c85d..aeb0732 100644
--- a/main/logger.c
+++ b/main/logger.c
@@ -408,7 +408,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/2069
To unsubscribe, visit https://gerrit.asterisk.org/settings

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



More information about the asterisk-code-review mailing list