From 1d503c770f566483fa727c3282434f85951beb91 Mon Sep 17 00:00:00 2001 From: winlin Date: Thu, 7 Apr 2022 13:48:19 +0800 Subject: [PATCH] Fix proc stat issue. --- trunk/src/app/srs_app_utility.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/trunk/src/app/srs_app_utility.cpp b/trunk/src/app/srs_app_utility.cpp index a17b9af71..5860afe3f 100644 --- a/trunk/src/app/srs_app_utility.cpp +++ b/trunk/src/app/srs_app_utility.cpp @@ -358,8 +358,9 @@ bool get_proc_self_stat(SrsProcSelfStat& r) srs_warn("open self cpu stat failed, ignore"); return false; } - - fscanf(f, "%d %32s %c %d %d %d %d " + + // Note that we must read less than the size of r.comm, such as %31s for r.comm is char[32]. + fscanf(f, "%d %31s %c %d %d %d %d " "%d %u %lu %lu %lu %lu " "%lu %lu %ld %ld %ld %ld " "%ld %ld %llu %lu %ld "