CVE-2025-2757: Unchecked Pointer Diff Memcpy

Calculated string length from pointer arithmetic is passed to memcpy without bounds checking. This can lead to a heap-based buffer overflow if the parsed string is longer than the fixed-size destination buffer. Add a bounds check against the calculated length before performing the memory copy.

Provally CuratedPublic repositoryHighMedium confidenceVerifiedApache-2.0C++β
greprules fetch cve-2025-2757-unchecked-pointer-diff-memcpy --engine opengrep

Description

Calculated string length from pointer arithmetic is passed to memcpy without bounds checking. This can lead to a heap-based buffer overflow if the parsed string is longer than the fixed-size destination buffer. Add a bounds check against the calculated length before performing the memory copy.