Skip to content

Missing Null Checking after HMAC_CTX_new at crypto/pkcs12/p12_mutl.c #4339

@viennadd

Description

@viennadd

Hi,

Our code scanner has reported a potential null pointer dereference at crypto/pkcs12/p12_mutl.c#L127, we can see there are null checks in other places after calling HMAC_CTX_new but there is no one at here. Could anyone have a look and see if it needs a fix?

At line 127

    hmac = HMAC_CTX_new();         // potential null would be returned
    if (!HMAC_Init_ex(hmac, key, md_size, md_type, NULL)      // <= use of potential null
        || !HMAC_Update(hmac, p12->authsafes->d.data->data,   // <= use of potential null
                        p12->authsafes->d.data->length)
        || !HMAC_Final(hmac, mac, maclen)) {                  // <= use of potential null
        HMAC_CTX_free(hmac);
        return 0;

Regards,
SourceBrella Inc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions