From acade348a7eb959dbff13ab942b895a041060822 Mon Sep 17 00:00:00 2001 From: KWSys Upstream Date: Fri, 25 Oct 2024 08:19:46 -0400 Subject: [PATCH] KWSys 2024-10-25 (7cff32e1) Code extracted from: https://gitlab.kitware.com/utils/kwsys.git at commit 7cff32e10e2bfe763415bc550816e8a9608e5954 (master). Upstream Shortlog ----------------- Brad King (1): 6e847d08 SystemInformation: Add missing EOF check when reading /proc/cpuinfo --- SystemInformation.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SystemInformation.cxx b/SystemInformation.cxx index 4efea54cb6..933d649339 100644 --- a/SystemInformation.cxx +++ b/SystemInformation.cxx @@ -3405,8 +3405,9 @@ bool SystemInformationImplementation::RetrieveInformationFromCpuInfoFile() } size_t fileSize = 0; - while (!feof(fd)) { - buffer += static_cast(fgetc(fd)); + int fc; + while ((fc = fgetc(fd)) != EOF) { + buffer += static_cast(fc); fileSize++; } fclose(fd);