Skip to content

Commit

Permalink
Clarify Windows C-string handling
Browse files Browse the repository at this point in the history
  • Loading branch information
complexspaces authored and ctz committed Aug 23, 2024
1 parent 12adeb0 commit 626e33c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rustls-platform-verifier/src/verification/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,11 @@ fn invalid_certificate(reason: impl Into<String>) -> rustls::Error {
/// - id-kp-serverAuth
// TODO: Chromium also allows for `OID_ANY_EKU` on Android.
#[cfg(target_os = "windows")]
// XXX: Windows requires that we NUL terminate EKU strings and we want to make sure that only the
// data part of the `&str` pointer (using `.as_ptr()`), not all of its metadata.
// This can be cleaned up when our MSRV is increased to 1.77 and C-string literals are available.
// See https://github.com/rustls/rustls-platform-verifier/issues/126#issuecomment-2306232794.
const ALLOWED_EKUS: &[*mut u8] = &["1.3.6.1.5.5.7.3.1\0".as_ptr() as *mut u8];

#[cfg(target_os = "android")]
pub const ALLOWED_EKUS: &[&str] = &["1.3.6.1.5.5.7.3.1"];

Expand Down

0 comments on commit 626e33c

Please sign in to comment.