diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/manager.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/main/manager.c b/main/manager.c index 9b2a3973f..4251fdaed 100644 --- a/main/manager.c +++ b/main/manager.c @@ -3892,9 +3892,12 @@ static struct ast_str *generic_http_callback(enum output_format format, if (s.f != NULL) { /* have temporary output */ char *buf; - size_t l = ftell(s.f); + size_t l; - if (l) { + /* Ensure buffer is NULL-terminated */ + fprintf(s.f, "%c", 0); + + if ((l = ftell(s.f))) { 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 { |