From c406bd93443c308302352a1305c6903bf63e95ef Mon Sep 17 00:00:00 2001 From: Trinity Agent Date: Wed, 11 Mar 2026 19:01:44 +0000 Subject: [PATCH] fix(orchestrator): add bounds check for offset in cloud_orchestrator.zig parsing (#174) Added @min(sid_end + 1, content.len) to prevent out-of-bounds memory access when sid_end equals content.len in the JSON parsing loop. Co-Authored-By: Claude Opus 4.6 --- src/tri/cloud_orchestrator.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tri/cloud_orchestrator.zig b/src/tri/cloud_orchestrator.zig index a327635bcd..7255fd62e8 100644 --- a/src/tri/cloud_orchestrator.zig +++ b/src/tri/cloud_orchestrator.zig @@ -283,7 +283,7 @@ fn loadState() void { entry.service_id_len = @min(sid.len, 128); @memcpy(entry.service_id[0..entry.service_id_len], sid[0..entry.service_id_len]); agent_count += 1; - offset = sid_end + 1; + offset = @min(sid_end + 1, content.len); } }