aboutsummaryrefslogtreecommitdiff
path: root/openssl/src
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2016-05-01 18:14:33 -0700
committerSteven Fackler <[email protected]>2016-05-01 18:14:33 -0700
commit59c13aea84496d3a68f3c280d8ff8f3b80651949 (patch)
tree89d60e7d04cef8347a5a3f0539d650fc01763662 /openssl/src
parentDocument SAN APIs and tweak accessor names (diff)
downloadrust-openssl-59c13aea84496d3a68f3c280d8ff8f3b80651949.tar.xz
rust-openssl-59c13aea84496d3a68f3c280d8ff8f3b80651949.zip
Still check UTF validity in dnsname
Diffstat (limited to 'openssl/src')
-rw-r--r--openssl/src/x509/mod.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/openssl/src/x509/mod.rs b/openssl/src/x509/mod.rs
index 6d38047a..0a242a15 100644
--- a/openssl/src/x509/mod.rs
+++ b/openssl/src/x509/mod.rs
@@ -882,7 +882,10 @@ impl<'a> GeneralName<'a> {
let len = ffi::ASN1_STRING_length((*self.name).d as *mut _);
let slice = slice::from_raw_parts(ptr as *const u8, len as usize);
- Some(str::from_utf8_unchecked(slice))
+ // dNSNames are stated to be ASCII (specifically IA5). Hopefully
+ // OpenSSL checks that when loading a certificate but if not we'll
+ // use this instead of from_utf8_unchecked just in case.
+ str::from_utf8(slice).ok()
}
}