提交 49303fda authored 作者: William King's avatar William King

read() does not NULL terminate statbuf, but strstr expects statbuf to be null terminated.

上级 48f423db
......@@ -124,6 +124,8 @@ static int read_cpu_stats(switch_profile_timer_t *p,
myerrno = errno;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to read CPU statistics file %s: %s\n", procfile, strerror(myerrno));
return -1;
} else {
statbuff[rc] = '\0';
}
cpustr = strstr(statbuff, "cpu ");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论