HP Fortify flags a privacy violation critical error when writing an id to archive. Below is the mock-up of the code snippet(As the code is CR protected)
void SampleBaseClass::Serialize(CArchive& ar)
{
// Serialize base class data first
CObject::Serialize(ar);
// Serialize my data now
if (ar.IsStoring())
{
ar << m_sPersonIdentificationNumber; //Flags the critical issue here
}
else
{
......
}
}
Is there a way to fix it without changing the design too much? I'd like to point out here that the variable m_sPersonIdentificationNumber is consumed by a lot of components. It is strongly coupled.