1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 23:03:53 -04:00

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