Skip to content

base64_encode_expected_len() returns value that is not large enough #4773

Closed
@jackjansen

Description

@jackjansen

base64_encode_expected_len() (from libb64/cencode.h) returns a number that is too small if it is used to allocate a buffer to subsequently pass to base64_encode_chars().

The reason is that the simple base64_encode_chars() includes a newline every 72 characters or so, and these newlines are not catered for in base64_encode_expected_len().

The result of this is that if you try to encode a binary blob larger than about 60 characters you will write past the end of your malloced space.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions