diff options
author | Tilghman Lesher <tilghman@meg.abyt.es> | 2009-10-27 20:22:07 +0000 |
---|---|---|
committer | Tilghman Lesher <tilghman@meg.abyt.es> | 2009-10-27 20:22:07 +0000 |
commit | c6a34a201e390716b944e0d6c0e3d5b2a482761e (patch) | |
tree | 097a44294d90527d11aae62fb8adf76bd4b874bc | |
parent | ba8176dc5271e99a127fac9d4b2d67c041e8c668 (diff) |
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: https://origsvn.digium.com/svn/asterisk/trunk@226159 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-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 a02d06106..1983ddeb2 100644 --- a/main/manager.c +++ b/main/manager.c @@ -4878,9 +4878,12 @@ static int generic_http_callback(struct ast_tcptls_session_instance *ser, 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 { |