]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-100372: Use BIO_eof to detect EOF for SSL_FILETYPE_ASN1 (GH-100373)
authorDavid Benjamin <davidben@google.com>
Fri, 24 Mar 2023 13:04:30 +0000 (09:04 -0400)
committerGitHub <noreply@github.com>
Fri, 24 Mar 2023 13:04:30 +0000 (06:04 -0700)
commitacfe02f3b05436658d92add6b168538b30f357f0
treea50504bd8a9806acbe3a25437fae0dc59d25dffa
parent6a1c49a7176f29435e71a326866d952b686bceb3
gh-100372: Use BIO_eof to detect EOF for SSL_FILETYPE_ASN1 (GH-100373)

In PEM, we need to parse until error and then suppress `PEM_R_NO_START_LINE`, because PEM allows arbitrary leading and trailing data. DER, however, does not. Parsing until error and suppressing `ASN1_R_HEADER_TOO_LONG` doesn't quite work because that error also covers some cases that should be rejected.

Instead, check `BIO_eof` early and stop the loop that way.

Automerge-Triggered-By: GH:Yhg1s
Lib/test/test_ssl.py
Misc/NEWS.d/next/Library/2022-12-20-10-55-14.gh-issue-100372.utfP65.rst [new file with mode: 0644]
Modules/_ssl.c