Skip to content

F-4935 - Guard word32 length overflow in wp_read_pem_bio - #452

Open
ColtonWilley wants to merge 1 commit into
wolfSSL:masterfrom
ColtonWilley:fix/f_4935
Open

F-4935 - Guard word32 length overflow in wp_read_pem_bio#452
ColtonWilley wants to merge 1 commit into
wolfSSL:masterfrom
ColtonWilley:fix/f_4935

Conversation

@ColtonWilley

@ColtonWilley ColtonWilley commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Fenrir F-4935. Ports the word32 bound already in wp_read_der_bio (#438).

Reported OOB write does not occur — on LP64 the realloc size computes in long, and CRYPTO_realloc(p, 0) returns NULL. Impact is truncation after 4GB.

wp_pem2der_decode set ok = 0 on read failure then overwrote it with the decode result. Now gated on ok.

Also fixes %d used for long readLen.

No test — the guard needs a 4GB PEM.

Port the UINT32_MAX bound already present in wp_read_der_bio. Honor a
failed read in wp_pem2der_decode instead of decoding a partial buffer.
Use WP_FITS_WORD32 in both guards and fix %d used for long readLen.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant