[svn-commits] tilghman: trunk r226159 - in /trunk: ./ main/manager.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Oct 27 15:22:14 CDT 2009


Author: tilghman
Date: Tue Oct 27 15:22:07 2009
New Revision: 226159

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=226159
Log:
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
........

Modified:
    trunk/   (props changed)
    trunk/main/manager.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/manager.c?view=diff&rev=226159&r1=226158&r2=226159
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Tue Oct 27 15:22:07 2009
@@ -4878,9 +4878,12 @@
 
 	if (s.f != NULL) {	/* have temporary output */
 		char *buf;
-		size_t l = ftell(s.f);
-
-		if (l) {
+		size_t 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 {




More information about the svn-commits mailing list