diff options
author | jade <lix@jade.fyi> | 2024-03-06 22:24:51 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@lix> | 2024-03-06 22:24:51 -0700 |
commit | 0d9a043f4365100c5b451b6476edb2b9ab09e19b (patch) | |
tree | 2573a380b9d7e42f74521b703d8327b7ed1f4197 /src/libutil/util.cc | |
parent | f10e673272425fd6f7b6d93a8f62bd7ff378e8c8 (diff) | |
parent | 6122bed3af3f9a46b471ba2920e728df4686dc79 (diff) |
Merge "fix: bounds check result in getMaxCPU" into main
Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r-- | src/libutil/util.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc index 51cda9da4..bbd57434d 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -796,6 +796,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") |