[asterisk-commits] sgriepentrog: trunk r429224 - in /trunk: ./ main/asterisk.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Dec 9 14:47:09 CST 2014


Author: sgriepentrog
Date: Tue Dec  9 14:47:05 2014
New Revision: 429224

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=429224
Log:
core: avoid possible asterisk -r crash from long id

When connecting to the remote console, an id string
is first provided that consts of the hostname, pid,
and version.  This is parsed by the remote instance
using a buffer that may be too short, and can allow
a buffer overrun because it is not terminated. This
patch adds termination and a larger buffer.

Review: https://reviewboard.asterisk.org/r/4182/
........

Merged revisions 429223 from http://svn.asterisk.org/svn/asterisk/branches/13

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

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

Modified: trunk/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/asterisk.c?view=diff&rev=429224&r1=429223&r2=429224
==============================================================================
--- trunk/main/asterisk.c (original)
+++ trunk/main/asterisk.c Tue Dec  9 14:47:05 2014
@@ -3200,7 +3200,7 @@
 
 static void ast_remotecontrol(char *data)
 {
-	char buf[80];
+	char buf[256] = "";
 	int res;
 	char filename[80] = "";
 	char *hostname;
@@ -3217,7 +3217,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