CVE-2025-64429: Cpp Ub Clearing String Data

Attempting to erase sensitive data by casting away constness on `.data()` and calling a memory clearing function invokes undefined behavior. It can result in the memory not being modified or the operation being optimized out, leaving sensitive data in memory. Use `&(*str)[0]` or a secure erasure function instead.

Provally CuratedPublic repositoryHighMedium confidenceVerifiedApache-2.0C++β
greprules fetch cve-2025-64429-cpp-ub-clearing-string-data --engine opengrep

Description

Attempting to erase sensitive data by casting away constness on `.data()` and calling a memory clearing function invokes undefined behavior. It can result in the memory not being modified or the operation being optimized out, leaving sensitive data in memory. Use `&(*str)[0]` or a secure erasure function instead.