Skip to content

Commit ae4a639

Browse files
committed
fix(cartridges): drop unnecessary @ptrCast from bug-filing-mcp adapter (CWE-704)
Same fix as the companion boj-server-cartridges PR: the three @ptrCast calls at the adapter's dispatch call site were unnecessary — Zig's [*c] pointer parameters accept array/slice/scalar pointers via implicit C-pointer coercion. Verified: zig build test green. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017LDhR8gtnittEWSafunnrq
1 parent fe389ec commit ae4a639

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

cartridges/bug-filing-mcp/adapter/bug_filing_mcp_adapter.zig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,10 @@ fn dispatch(tool: []const u8, args_json: []const u8, out: []u8) Dispatch {
103103
abuf[a.len] = 0;
104104

105105
var len: usize = out.len;
106-
const rc = ffi.boj_cartridge_invoke(@ptrCast(&tnbuf), @ptrCast(&abuf), @ptrCast(out.ptr), &len);
106+
// No @ptrCast needed (CWE-704 fix, matching #89's cartridge_shim.zig
107+
// pattern): [*c] parameters accept array/slice/scalar pointers via
108+
// Zig's own implicit C-pointer coercion.
109+
const rc = ffi.boj_cartridge_invoke(&tnbuf, &abuf, out.ptr, &len);
107110
return switch (rc) {
108111
0 => .{ .status = 200, .body = out[0..len] },
109112
-1 => .{ .status = 404, .body = "{\"error\":\"unknown-tool\"}" },

0 commit comments

Comments
 (0)