From 49303fdabc52797c7b8a27efef05d729543c2d16 Mon Sep 17 00:00:00 2001 From: William King Date: Sat, 18 May 2013 14:26:40 -0700 Subject: [PATCH] read() does not NULL terminate statbuf, but strstr expects statbuf to be null terminated. --- src/switch_profile.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/switch_profile.c b/src/switch_profile.c index f1c2247979..b4171ef6f2 100644 --- a/src/switch_profile.c +++ b/src/switch_profile.c @@ -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 ");