Index: main/manager.c =================================================================== --- main/manager.c (revision 317194) +++ main/manager.c (working copy) @@ -4051,17 +4051,19 @@ char *buf; size_t l; + /* Make sure we have room at the end for a terminating NULL */ + fputc(0, s.f); + if ((l = ftell(s.f))) { - if (MAP_FAILED == (buf = mmap(NULL, l + 1, PROT_READ | PROT_WRITE, MAP_PRIVATE, s.fd, 0))) { + if (MAP_FAILED == (buf = mmap(NULL, l, PROT_READ | PROT_WRITE, MAP_PRIVATE, s.fd, 0))) { ast_log(LOG_WARNING, "mmap failed. Manager output was not processed\n"); } else { - buf[l] = '\0'; if (format == FORMAT_XML || format == FORMAT_HTML) { xml_translate(&out, buf, params, format); } else { ast_str_append(&out, 0, "%s", buf); } - munmap(buf, l + 1); + munmap(buf, l); } } else if (format == FORMAT_XML || format == FORMAT_HTML) { xml_translate(&out, "", params, format);