read() does not NULL terminate statbuf, but strstr expects statbuf to be null terminated.
This commit is contained in:
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 ");
|
||||||
|
|
Loading…
Reference in New Issue