提交 8f436a9d authored 作者: Michael Jerris's avatar Michael Jerris

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
上级 3fc660fc
...@@ -824,7 +824,7 @@ SWITCH_DECLARE(void) switch_console_loop(void) ...@@ -824,7 +824,7 @@ SWITCH_DECLARE(void) switch_console_loop(void)
for (x = 0; x < (sizeof(cmd) - 1); x++) { for (x = 0; x < (sizeof(cmd) - 1); x++) {
int c = getchar(); int c = getchar();
if (c < 0) { if (c < 0) {
int y = read(fileno(stdin), cmd, sizeof(cmd)); int y = read(fileno(stdin), cmd, sizeof(cmd) - 1);
cmd[y - 1] = '\0'; cmd[y - 1] = '\0';
break; break;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论