Fix DER reading from stdin for BIO_f_readbuffer
authorShane Lontis <shane.lontis@oracle.com>
Thu, 18 Mar 2021 05:00:23 +0000 (15:00 +1000)
committerShane Lontis <shane.lontis@oracle.com>
Sun, 21 Mar 2021 23:07:36 +0000 (09:07 +1000)
commit251c48183b4d8934716ac1e5e66e2a10b81373fe
treea71ce4fd91efef5ab238abee50b2aa0792c714ac
parent6e34a1048ce4871371eac224b995c3b4338f6166
Fix DER reading from stdin for BIO_f_readbuffer

Fixes #14559

The intitial implementation of the gets() function tried using the next bio's gets() function.
For a file BIO this returned incorrect data for binary data containing 0x00.
Just buffering all data during gets() did not work however since some
applications open and close the bio multiple times when dealing with pem
files containing multiple entries.. This does not work
when reading from stdin unless the data if buffered one byte at a time.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14599)
crypto/bio/bf_readbuff.c
test/bio_readbuffer_test.c [new file with mode: 0644]
test/build.info
test/recipes/61-test_bio_readbuffer.t [new file with mode: 0644]