[asterisk-commits] tilghman: branch 1.4 r226138 - /branches/1.4/main/manager.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Oct 27 15:16:55 CDT 2009
Author: tilghman
Date: Tue Oct 27 15:16:49 2009
New Revision: 226138
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=226138
Log:
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
Modified:
branches/1.4/main/manager.c
Modified: branches/1.4/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/main/manager.c?view=diff&rev=226138&r1=226137&r2=226138
==============================================================================
--- branches/1.4/main/manager.c (original)
+++ branches/1.4/main/manager.c Tue Oct 27 15:16:49 2009
@@ -2882,8 +2882,12 @@
ast_mutex_lock(&s->__lock);
if (ss.fd > -1) {
char *buf;
- size_t l = lseek(ss.fd, 0, SEEK_END);
- if (l) {
+ size_t l;
+
+ /* Ensure buffer is NULL-terminated */
+ fprintf(ss.f, "%c", 0);
+
+ if ((l = lseek(ss.fd, 0, SEEK_END)) > 0) {
if (MAP_FAILED == (buf = mmap(NULL, l, PROT_READ | PROT_WRITE, MAP_PRIVATE, ss.fd, 0))) {
ast_log(LOG_WARNING, "mmap failed. Manager request output was not processed\n");
} else {
More information about the asterisk-commits
mailing list