From: William King Date: Sat, 18 May 2013 21:26:40 +0000 (-0700) Subject: read() does not NULL terminate statbuf, but strstr expects statbuf to be null terminated. X-Git-Tag: v1.2.10~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=49303fdabc52797c7b8a27efef05d729543c2d16;p=thirdparty%2Ffreeswitch.git read() does not NULL terminate statbuf, but strstr expects statbuf to be null terminated. --- 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 ");