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

This commit is contained in:
William King 2013-05-18 14:26:40 -07:00
parent 48f423db40
commit 49303fdabc
1 changed files with 2 additions and 0 deletions

View File

@ -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 ");