[asterisk-commits] mmichelson: branch 11 r433919 - /branches/11/main/asterisk.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 1 15:43:38 CDT 2015


Author: mmichelson
Date: Wed Apr  1 15:43:31 2015
New Revision: 433919

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=433919
Log:
Backport revision 429223 from Asterisk 13

The bug fixed by that patch exists in Asterisk 11 as
well, so the fix should be applied there.

When connecting to a remote Asterisk console, the buffer
used to read the initial hostname/pid/version from the
main Asterisk process did not ensure the input was
NULL-terminated, and the buffer was small for certain
use cases. This patch expands the buffer to be 256
bytes and ensures the input it reads is NULL-terminated.

ASTERISK-21854 #close
Reported by klaus3000


Modified:
    branches/11/main/asterisk.c

Modified: branches/11/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/main/asterisk.c?view=diff&rev=433919&r1=433918&r2=433919
==============================================================================
--- branches/11/main/asterisk.c (original)
+++ branches/11/main/asterisk.c Wed Apr  1 15:43:31 2015
@@ -3056,7 +3056,7 @@
 
 static void ast_remotecontrol(char *data)
 {
-	char buf[80];
+	char buf[256] = "";
 	int res;
 	char filename[80] = "";
 	char *hostname;
@@ -3073,7 +3073,7 @@
 	signal(SIGTERM, __remote_quit_handler);
 	signal(SIGHUP, __remote_quit_handler);
 
-	if (read(ast_consock, buf, sizeof(buf)) < 0) {
+	if (read(ast_consock, buf, sizeof(buf) - 1) < 0) {
 		ast_log(LOG_ERROR, "read() failed: %s\n", strerror(errno));
 		return;
 	}




More information about the asterisk-commits mailing list