]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
logger.c: Fix buffer overrun found by address sanitizer. 69/2069/1
authorRichard Mudgett <rmudgett@digium.com>
Fri, 22 Jan 2016 17:48:24 +0000 (11:48 -0600)
committerRichard Mudgett <rmudgett@digium.com>
Fri, 22 Jan 2016 18:36:10 +0000 (12:36 -0600)
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

main/logger.c

index 795c85d97b7047afcea2092b2235583fe8a45872..aeb07325d6c6101853d0dee4418134237d427150 100644 (file)
@@ -408,7 +408,7 @@ static int init_logger_chain(int locked, const char *altconf)
 
        /* 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;
                }