Skip to content

Commit

Permalink
Merge pull request #10172 from lf-/jade/fix-9725
Browse files Browse the repository at this point in the history
fix: bounds check result in getMaxCPU
  • Loading branch information
tomberek committed Mar 7, 2024
2 parents c4cfa18 + 9c64a09 commit 0a11080
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 0a11080

Please sign in to comment.