C++ Logo

std-discussion

Advanced search

Re: C++ language has a big security hole.

From: Andrey Semashev <andrey.semashev_at_[hidden]>
Date: Mon, 17 Feb 2025 17:15:15 +0300
On 2/17/25 12:33, Amit via Std-Discussion wrote:
> C++ language has a big security hole. You can change the values of the
> private member variables directly by getting the pointer to the
> object. So, private member variables are actually not private, they
> are public.

Others have already said about UB, I just wanted to add that member
access specifiers are not (and never were) a security measure. As such,
even if you could have a legal way of accessing a private member, this
would still not constitute a security breach.

Received on 2025-02-17 14:15:19