fix(bootstrap): add bounds check to extractBalancedBraceContent

Return null when startPos exceeds string length to prevent out-of-bounds
access. Add comprehensive test coverage for environment variable parsing
edge cases.
This commit is contained in:
Andras Bacsai committed 2026-03-02 12:24:40 +01:00
1 parent 9b7e2e15b0
commit 059164224c
2 files changed
+354

No files matched your search

+3
View File
@@ -28,6 +28,9 @@ function collectRegex(string $name)
function extractBalancedBraceContent(string $str, int $startPos = 0): ?array
{
// Find opening brace
if ($startPos >= strlen($str)) {
return null;
}
$openPos = strpos($str, '{', $startPos);
if ($openPos === false) {
return null;