Original Ticket (closed for reference): #388
It has been observed that there is no handling for scenarios where the pointer is NULL while the length is valid. Generally, a NULL pointer with a valid length is considered an invalid state and may lead to a client application crash during memory operations such as memcpy.
Suggested Approach:
Return a ‘bad parameter’ error when the pointer is NULL but the length is valid. This requires changes in two areas:
serialize_ck_mecha_params mechanism – Handle cases where Uparameter is NULL and UlparameterLen is valid.
serialize function – Validate for NULL data along with a valid length.
By implementing this approach, we can prevent client application crashes and handle the scenario deterministically with an appropriate error condition.