Skip to content

fix: three memcpy operations in jv_print in jv_print.c#3521

Closed
orbisai0security wants to merge 1 commit intojqlang:masterfrom
orbisai0security:fix-fix-v-001-memcpy-bounds-check-jv-print
Closed

fix: three memcpy operations in jv_print in jv_print.c#3521
orbisai0security wants to merge 1 commit intojqlang:masterfrom
orbisai0security:fix-fix-v-001-memcpy-bounds-check-jv-print

Conversation

@orbisai0security
Copy link
Copy Markdown

Summary

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

Vulnerability

Field Value
ID V-001
Severity CRITICAL
Scanner multi_agent_ai
Rule V-001
File src/jv_print.c:86
CWE CWE-120

Description: Three memcpy operations in jv_print.c copy data into destination buffers without verifying that the source length fits within the remaining destination buffer capacity. At line 86, memcpy(cb + 2, codes[ci], len) does not confirm that len bytes are available in the cb buffer beyond offset 2. At lines 426 and 434, memcpy(outbuf, str, l) does not validate l against the allocated size of outbuf. A crafted JSON input that produces an oversized color code, string segment, or output value triggers a heap buffer overflow, overwriting adjacent heap metadata or allocations.

Changes

  • src/jv_print.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
@itchyny
Copy link
Copy Markdown
Contributor

itchyny commented Apr 24, 2026

This is a low quality automated security reports.

@itchyny itchyny closed this Apr 24, 2026
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