diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-10-27 20:24:02 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-10-27 20:24:02 +0000 |
commit | e76e0027255fd2dadf82d6f1305ecf5e8e3f9da4 (patch) | |
tree | bce1a4b7a5a1dc8fd15ea7a1e71793000700e527 /main | |
parent | 0088fbcf5352da4d7be30192d6a1953b5b2baff6 (diff) |
Merged revisions 226159 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r226159 | tilghman | 2009-10-27 15:22:07 -0500 (Tue, 27 Oct 2009) | 14 lines
Merged revisions 226138 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r226138 | tilghman | 2009-10-27 15:16:49 -0500 (Tue, 27 Oct 2009) | 7 lines
Manager output is not always NULL-terminated, so force a NULL at the end of the filestream.
(closes issue #15495)
Reported by: pdf
Patches:
20090916__issue15495.diff.txt uploaded by tilghman (license 14)
Tested by: pdf
........
................
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.1@226169 f38db490-d61c-443f-a65b-d21fe96a405b
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 { |