Skip to content

fix: two string copy functions in misc in misc.c#159

Open
orbisai0security wants to merge 1 commit into
editorconfig:masterfrom
orbisai0security:fix-v-001-integer-overflow-misc-c
Open

fix: two string copy functions in misc in misc.c#159
orbisai0security wants to merge 1 commit into
editorconfig:masterfrom
orbisai0security:fix-v-001-integer-overflow-misc-c

Conversation

@orbisai0security

Copy link
Copy Markdown

Summary

Fix critical severity security issue in src/lib/misc.c.

Vulnerability

Field Value
ID V-001
Severity CRITICAL
Scanner multi_agent_ai
Rule V-001
File src/lib/misc.c:128
CWE CWE-190

Description: Two string copy functions in misc.c allocate heap buffers using a caller-supplied length value and immediately copy that many bytes via memcpy without any upper-bound validation. At line 128-130, malloc(len) allocates exactly 'len' bytes and memcpy copies 'len' bytes — if 'len' is derived from attacker-controlled input and exceeds the actual string length, or if an integer overflow caused malloc to allocate fewer bytes than intended, the memcpy writes beyond the heap allocation. At line 186-188, malloc(len+1) is susceptible to integer overflow when len equals SIZE_MAX, producing a zero-byte allocation followed by a full-length memcpy overwrite of the entire heap.

Changes

  • src/lib/misc.c

Verification

  • Build passes
  • Scanner re-scan confirms fix
  • LLM code review passed

Automated security fix by OrbisAI Security

Automated security fix generated by Orbis Security AI
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.

1 participant