Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@fffonion
Copy link
Contributor

@fffonion fffonion commented Feb 3, 2020

In x509.new(), csr.new(), and crl.new() when it's initialized from a DER text and
format is * or unset, the same BIO struct is reused for two times. While the pointer is
already modified in PEM_read_bio_*, later d2i_*_bio call will always fail.

This patch resets the BIO after first use so that DER format can be correctly loaded.

local f = io.open("a_der_formated_crl.crl"):read("*a")
require("openssl.x509.crl").new(f)
-- ERROR: x509.crl.new: asn1_lib.c:101:error:0D07207B:asn1 encoding routines:ASN1_get_object:header too long

@daurnimator
Copy link
Collaborator

Could you add a regression test?

@fffonion
Copy link
Contributor Author

fffonion commented Feb 5, 2020

Yes, I just added regression test.

@daurnimator daurnimator merged commit e48a9ba into wahern:master Feb 5, 2020
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.

2 participants