]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Avoid non null terminated string. Found by Klockwork (www.klocwork.com)
authorMichael Jerris <mike@jerris.com>
Thu, 15 May 2008 21:25:26 +0000 (21:25 +0000)
committerMichael Jerris <mike@jerris.com>
Thu, 15 May 2008 21:25:26 +0000 (21:25 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8423 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_console.c

index be67529458a4ea932f3c41f70aa52d801bafdec1..4f765c81f39640bf8e51d246806aa12aa6e99cbe 100644 (file)
@@ -824,7 +824,7 @@ SWITCH_DECLARE(void) switch_console_loop(void)
                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;
                        }