Skip to content

Commit cb4c0cc

Browse files
fix(bug-filing-mcp): drop unnecessary @ptrCast from the adapter dispatch call (CWE-704) (#91)
<!-- SPDX-License-Identifier: CC-BY-SA-4.0 --> ## Summary Follow-up to #89 (fixed the FFI shim's internal `@ptrCast`s across all 116 cartridges) and #90 (shipped bug-filing-mcp's new adapter with the old pre-#89 dispatch pattern, mirrored from k9iser-mcp before its own equivalent was cleaned up). Drops the three now-unnecessary `@ptrCast` calls at the adapter's dispatch call site — the same CWE-704 finding class, one file further down the stack. Confirmed with a standalone `zig build-obj` test before touching the real file: Zig's `[*c]` pointer parameters accept array/slice/scalar pointers via implicit C-pointer coercion, so the explicit casts were doing nothing. ## Schema-validation note - [ ] This PR adds or modifies one or more `cartridge.json` manifests. - [x] This PR does not touch any `cartridge.json`. ## Testing - `zig build test` (0.15.2): green. - Rebuilt the binary and re-ran the live smoke test (REST dispatch to `/invoke?tool=submit_feedback`, 404 on unknown route) — confirmed no behavioral change. ## Refs Follow-up to #89/#90. Part of #274. Same fix will be applied to the bundled snapshot in `boj-server`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017LDhR8gtnittEWSafunnrq --- _Generated by [Claude Code](https://claude.ai/code/session_017LDhR8gtnittEWSafunnrq)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent d0d89f6 commit cb4c0cc

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

cartridges/domains/development/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)