Skip to content

fix: add bounds check before memcpy in blemidi.c#414

Open
orbisai0security wants to merge 1 commit into
Builty:mainfrom
orbisai0security:fix-heap-buffer-overflow-blemidi-packet-assembly
Open

fix: add bounds check before memcpy in blemidi.c#414
orbisai0security wants to merge 1 commit into
Builty:mainfrom
orbisai0security:fix-heap-buffer-overflow-blemidi-packet-assembly

Conversation

@orbisai0security
Copy link
Copy Markdown

Summary

Fix critical severity security issue in minimidi/source/components/blemidi/blemidi.c.

Vulnerability

Field Value
ID V-001
Severity CRITICAL
Scanner multi_agent_ai
Rule V-001
File minimidi/source/components/blemidi/blemidi.c:265

Description: The BLE MIDI packet assembly code allocates a heap buffer of size 'packet_len' and copies incoming BLE MIDI stream data into it using memcpy with a fixed offset (+2 or +1). The 'len' parameter is derived from BLE MIDI stream data controlled by a remote BLE client. No bounds check ensures that 'len' fits within the remaining buffer space after the offset, allowing a remote attacker to write beyond the allocated heap buffer.

Changes

  • minimidi/source/components/blemidi/blemidi.c

Verification

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

Automated security fix by OrbisAI Security

Automated security fix generated by OrbisAI Security
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