hydra-queue-runner: Fix potential UB

Removing two characters from a string when it starts with " can lead to
a substring call with -1
This commit is contained in:
Janne Heß
2025-08-02 15:02:48 +02:00
committed by ahuston-0
parent 3eeba86a87
commit 21a75982aa

View File

@@ -78,7 +78,7 @@ BuildOutput getBuildOutput(
product.type = match[1]; product.type = match[1];
product.subtype = match[2]; product.subtype = match[2];
std::string s(match[3]); std::string s(match[3]);
product.path = s[0] == '"' ? std::string(s, 1, s.size() - 2) : s; product.path = s[0] == '"' && s.back() == '"' ? std::string(s, 1, s.size() - 2) : s;
product.defaultPath = match[5]; product.defaultPath = match[5];
/* Ensure that the path exists and points into the Nix /* Ensure that the path exists and points into the Nix