mirror of
https://github.com/openharmony/third_party_rust_rust-openssl.git
synced 2026-07-19 15:13:31 -04:00
修复 rust-openssl LJ-2023-0078479 问题
Signed-off-by: hu-kai45 <hukai45@huawei.com>
This commit is contained in:
@@ -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(|_| ())
|
||||
|
||||
Reference in New Issue
Block a user