1
0
mirror of https://github.com/signalwire/freeswitch.git synced 2025-03-07 10:48:06 +00:00

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

@ -124,6 +124,8 @@ static int read_cpu_stats(switch_profile_timer_t *p,
myerrno = errno; myerrno = errno;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to read CPU statistics file %s: %s\n", procfile, strerror(myerrno)); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to read CPU statistics file %s: %s\n", procfile, strerror(myerrno));
return -1; return -1;
} else {
statbuff[rc] = '\0';
} }
cpustr = strstr(statbuff, "cpu "); cpustr = strstr(statbuff, "cpu ");