修复 rust-openssl LJ-2023-0078479 问题

Signed-off-by: hu-kai45 <hukai45@huawei.com>
This commit is contained in:
hu-kai45
2023-08-04 12:07:04 +08:00
parent 2931513b30
commit 796436ca9c
+3 -1
View File
@@ -120,9 +120,11 @@ impl X509VerifyParamRef {
#[corresponds(X509_VERIFY_PARAM_set1_host)]
pub fn set_host(&mut self, host: &str) -> Result<(), ErrorStack> {
unsafe {
// len == 0 means "run strlen" :(
let raw_host = if host.is_empty() { "\0" } else { host };
cvt(ffi::X509_VERIFY_PARAM_set1_host(
self.as_ptr(),
host.as_ptr() as *const _,
raw_host.as_ptr() as *const _,
host.len(),
))
.map(|_| ())