Skip to content

fix: add buffer-length check in validation.c - #182

Open
anupamme wants to merge 598 commits into
FabricLabs:developfrom
anupamme:fix-repo-fabric-v-001-safe-string-copy-strcpy
Open

fix: add buffer-length check in validation.c#182
anupamme wants to merge 598 commits into
FabricLabs:developfrom
anupamme:fix-repo-fabric-v-001-safe-string-copy-strcpy

Conversation

@anupamme

@anupamme anupamme commented Aug 6, 2026

Copy link
Copy Markdown

Summary

Fix critical severity security issue in src/validation.c.

Vulnerability

Field Value
ID V-001
Severity CRITICAL
Scanner multi_agent_ai
Rule V-001
File src/validation.c:408
Assessment Likely exploitable
CWE CWE-120

Description: The function fabric_safe_string_copy() uses strcpy() without proper bounds checking, despite performing a length check. If the check is bypassed or if src_len equals dest_size, strcpy() will copy src_len + 1 bytes (including null terminator), causing a 1-byte buffer overflow.

Evidence

Exploitation scenario: Call fabric_safe_string_copy() with a source string exactly dest_size bytes long.

Scanner confirmation: multi_agent_ai rule V-001 flagged this pattern.

Production code: This file is in the production codebase, not test-only code.

Threat Model Context

This is a Node.js library - vulnerabilities affect downstream consumers who use this package.

Changes

  • src/validation.c

Behavior Preservation

The change is scoped to 1 file on the vulnerable path; it only tightens handling of untrusted input and leaves valid inputs unaffected.


Automated security fix by OrbisAI Security

- CHANGELOG: 2026-03-21 + [0.1.0-RC2] sections merged
- GOALS/CONTRIBUTING/DEVELOPERS: combine checklist + VISION + FabricShell + keygen
- Drop conflicted docs/*.html; scripts/clean-jsdoc-html.js + make:docs
- make:api/make:docs use scripts/list-jsdoc-type-files.js (recursive for HTML)

Made-with: Cursor
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b909b413-83d6-433b-8233-60cca37ddcd5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants