Skip to content

PEM_read_bio_ex might return 0 without setting the error message in some situation #11962

Description

@spacewander

When EVP_DecodeFinal doesn't update the &taillen, then len is 0:

/* There was no data in the PEM file; avoid malloc(0). */
if (len == 0)
goto end;

This execute path might be triggered by a malformed PEM file.

Another possible case:

*header = pem_malloc(headerlen + 1, flags);
*data = pem_malloc(len, flags);
if (*header == NULL || *data == NULL) {
pem_free(*header, flags, 0);
pem_free(*data, flags, 0);
goto end;

Metadata

Metadata

Assignees

No one assigned

    Labels

    triaged: bugThe issue/pr is/fixes a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions