]> git.ipfire.org Git - thirdparty/openssl.git/commit
Fix certificate read from stdin on Windows
authorMilan Broz <gmazyland@gmail.com>
Tue, 24 Mar 2026 13:50:21 +0000 (14:50 +0100)
committerEugene Syromiatnikov <esyr@openssl.org>
Tue, 31 Mar 2026 01:36:58 +0000 (03:36 +0200)
commitb238d36c50a177eb8d5fb384e51fe03c9e81001a
tree3201693b167630bca8e7a153f303840ce65c79db
parentb0380fa9331e8d9d4d8b1ab7c3f57d7a35603757
Fix certificate read from stdin on Windows

On Windows, reading certificate from stdin could fail like

    > type cert.der| openssl.exe x509 -inform DER -outform PEM
    Could not find or decode certificate from <stdin>

The decoder already tries to insert BIO_f_readbuffer
in this case, unfortunately it depends on undefined behavior
of ftell() on Windows.

Fix it by adding check for non-seekable input case
to BIO file control.

Note, the added testcase tests binary input certificate,
but does not trigger this issue explicitly.

Fixes: https://github.com/openssl/openssl/issues/19508
Signed-off-by: Milan Broz <gmazyland@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue Mar 31 01:38:21 2026
(Merged from https://github.com/openssl/openssl/pull/30559)
crypto/bio/bss_file.c
test/recipes/61-test_bio_readbuffer.t