[Freeswitch-svn] [commit] r8423 - freeswitch/trunk/src

Freeswitch SVN mikej at freeswitch.org
Thu May 15 17:25:26 EDT 2008


Author: mikej
Date: Thu May 15 17:25:26 2008
New Revision: 8423

Modified:
   freeswitch/trunk/src/switch_console.c

Log:
Avoid non null terminated string. Found by Klockwork (www.klocwork.com)

Modified: freeswitch/trunk/src/switch_console.c
==============================================================================
--- freeswitch/trunk/src/switch_console.c	(original)
+++ freeswitch/trunk/src/switch_console.c	Thu May 15 17:25:26 2008
@@ -824,7 +824,7 @@
 		for (x = 0; x < (sizeof(cmd) - 1); x++) {
 			int c = getchar();
 			if (c < 0) {
-				int y = read(fileno(stdin), cmd, sizeof(cmd));
+				int y = read(fileno(stdin), cmd, sizeof(cmd) - 1);
 				cmd[y - 1] = '\0';
 				break;
 			}



More information about the Freeswitch-svn mailing list