Skip to content
OpenAdvisories

Weakness (CWE)

CWE-495: Private Data Structure Returned From A Public Method

Variant Draft

The product has a method that is declared public, but returns a reference to a private data structure, which could then be modified in unexpected ways.

How to prevent it (3 mitigations)
  1. Implementation

    Declare the method private.

  2. Implementation

    Clone the member data and keep an unmodified version of the data private to the object.

  3. Implementation

    Use public setter methods that govern how a private member can be modified.

Source: MITRE CWE-495

0 results · Clear filters · Feed

Nothing found.