Fix race condition with X509Name creation

This commit is contained in:
Alex Gaynor 2023-03-21 20:49:48 -04:00 committed by Anthony Ramine
parent 90dfe2f912
commit b36b1705b3
1 changed files with 4 additions and 1 deletions

View File

@ -962,7 +962,10 @@ impl X509NameBuilder {
/// Return an `X509Name`.
pub fn build(self) -> X509Name {
self.0
// Round-trip through bytes because OpenSSL is not const correct and
// names in a "modified" state compute various things lazily. This can
// lead to data-races because OpenSSL doesn't have locks or anything.
X509Name::from_der(&self.0.to_der().unwrap()).unwrap()
}
}