]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
read() does not NULL terminate statbuf, but strstr expects statbuf to be null terminated.
authorWilliam King <william.king@quentustech.com>
Sat, 18 May 2013 21:26:40 +0000 (14:26 -0700)
committerWilliam King <william.king@quentustech.com>
Sat, 18 May 2013 21:27:00 +0000 (14:27 -0700)
src/switch_profile.c

index f1c22479796a3924d34541a5e4c2470f6693cf49..b4171ef6f2d1fdfc4281953807d993fc2bb2256e 100644 (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 ");