Skip to content

Commit

Permalink
fix: bounds check result in getMaxCPU
Browse files Browse the repository at this point in the history
  • Loading branch information
lf- authored and yshui committed Mar 18, 2024
1 parent d0ca925 commit fe7489b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/libutil/current-process.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ unsigned int getMaxCPU()

auto cpuMax = readFile(cpuFile);
auto cpuMaxParts = tokenizeString<std::vector<std::string>>(cpuMax, " \n");

if (cpuMaxParts.size() != 2) {
return 0;
}

auto quota = cpuMaxParts[0];
auto period = cpuMaxParts[1];
if (quota != "max")
Expand Down

0 comments on commit fe7489b

Please sign in to comment.