Skip to content

fix: at qdl in qdl.c#241

Open
orbisai0security wants to merge 1 commit into
linux-msm:masterfrom
orbisai0security:fix-malloc-null-check-and-double-free-qdl
Open

fix: at qdl in qdl.c#241
orbisai0security wants to merge 1 commit into
linux-msm:masterfrom
orbisai0security:fix-malloc-null-check-and-double-free-qdl

Conversation

@orbisai0security
Copy link
Copy Markdown

Summary

Fix critical severity security issue in qdl.c.

Vulnerability

Field Value
ID V-001
Severity CRITICAL
Scanner multi_agent_ai
Rule V-001
File qdl.c:253
CWE CWE-190

Description: At qdl.c:253, memory is allocated with malloc(filesize) and immediately used in memcpy(images[id].ptr, ptr, filesize) at qdl.c:254. There is no check that malloc succeeded before the memcpy, and no validation that filesize accurately reflects the actual size of the source buffer pointed to by ptr. If filesize is derived from attacker-controlled firmware image header fields, a crafted value can cause the memcpy to read beyond the source buffer or, if combined with integer overflow, write into an undersized heap allocation.

Changes

  • qdl.c

Verification

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

Automated security fix by OrbisAI Security

@quic-bjorande
Copy link
Copy Markdown
Contributor

quic-bjorande commented May 15, 2026

Thank you for the bug fix. Please tell your AI to write a commit message that matches the style of the project. Then please tell a human to review and add the required signed-off-by.

malloc() can return NULL when allocation fails, but the return value
was not checked before passing the pointer to memcpy(). This causes a
null pointer dereference if the system is out of memory or if filesize
is zero.

Add the missing NULL check and jump to the existing err label, which
already handles cleanup of previously allocated images and blob->ptr.

Signed-off-by: OrbisAI Security <mediratta01.pally@gmail.com>
@orbisai0security orbisai0security force-pushed the fix-malloc-null-check-and-double-free-qdl branch from 7516e6b to c82c207 Compare May 16, 2026 02:07
@orbisai0security
Copy link
Copy Markdown
Author

Thank you for the bug fix. Please tell your AI to write a commit message that matches the style of the project. Then please tell a human to review and add the required signed-off-by.

Acked. Pls review again.

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