From: Michael Jerris Date: Thu, 15 May 2008 21:25:26 +0000 (+0000) Subject: Avoid non null terminated string. Found by Klockwork (www.klocwork.com) X-Git-Tag: v1.0-rc6~77 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f436a9d5252a8d14f4b366f8374a0ca02f942bf;p=thirdparty%2Ffreeswitch.git Avoid non null terminated string. Found by Klockwork (www.klocwork.com) git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8423 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- diff --git a/src/switch_console.c b/src/switch_console.c index be67529458..4f765c81f3 100644 --- a/src/switch_console.c +++ b/src/switch_console.c @@ -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; }