fix: bounds check result in getMaxCPU

Fixes https://github.com/NixOS/nix/issues/9725
This commit is contained in:
Jade Lovelace 2024-03-06 20:52:58 -08:00
parent bdb6f56c90
commit 9c64a09c70

View file

@ -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")