CVE-2026-41509: Unchecked Sizeof Underflow To Memcpy

Unchecked subtraction of `sizeof` from a length variable before a memory copy operation. This can lead to integer underflow if the length is smaller than the `sizeof` value, causing an out-of-bounds read/write when passed to `memcpy` or `memmove`. Always validate the length before subtraction.

Provally CuratedPublic repositoryHighMedium confidenceVerifiedApache-2.0C
greprules fetch cve-2026-41509-unchecked-sizeof-underflow-to-memcpy --engine opengrep

Description

Unchecked subtraction of `sizeof` from a length variable before a memory copy operation. This can lead to integer underflow if the length is smaller than the `sizeof` value, causing an out-of-bounds read/write when passed to `memcpy` or `memmove`. Always validate the length before subtraction.