diff options
Diffstat (limited to 'security/manager/ssl/ipcclientcerts')
-rw-r--r-- | security/manager/ssl/ipcclientcerts/src/backend.rs | 16 | ||||
-rw-r--r-- | security/manager/ssl/ipcclientcerts/src/lib.rs | 5 |
2 files changed, 17 insertions, 4 deletions
diff --git a/security/manager/ssl/ipcclientcerts/src/backend.rs b/security/manager/ssl/ipcclientcerts/src/backend.rs index 534eecd47e..44048d3116 100644 --- a/security/manager/ssl/ipcclientcerts/src/backend.rs +++ b/security/manager/ssl/ipcclientcerts/src/backend.rs @@ -282,7 +282,9 @@ impl Sign for Key { unsafe extern "C" fn sign_callback(data_len: usize, data: *const u8, ctx: *mut c_void) { let signature: &mut Vec<u8> = std::mem::transmute(ctx); signature.clear(); - signature.extend_from_slice(std::slice::from_raw_parts(data, data_len)); + if data_len != 0 { + signature.extend_from_slice(std::slice::from_raw_parts(data, data_len)); + } } unsafe extern "C" fn find_objects_callback( @@ -294,8 +296,16 @@ unsafe extern "C" fn find_objects_callback( slot_type: u32, ctx: *mut c_void, ) { - let data = std::slice::from_raw_parts(data, data_len); - let extra = std::slice::from_raw_parts(extra, extra_len); + let data = if data_len == 0 { + &[] + } else { + std::slice::from_raw_parts(data, data_len) + }; + let extra = if extra_len == 0 { + &[] + } else { + std::slice::from_raw_parts(extra, extra_len) + }; let slot_type = match slot_type { 1 => SlotType::Modern, 2 => SlotType::Legacy, diff --git a/security/manager/ssl/ipcclientcerts/src/lib.rs b/security/manager/ssl/ipcclientcerts/src/lib.rs index f76449909b..687fef09f6 100644 --- a/security/manager/ssl/ipcclientcerts/src/lib.rs +++ b/security/manager/ssl/ipcclientcerts/src/lib.rs @@ -1045,5 +1045,8 @@ pub extern "C" fn IPCCC_GetFunctionList(ppFunctionList: CK_FUNCTION_LIST_PTR_PTR CKR_OK } -#[cfg_attr(any(target_os = "macos", target_os = "ios"), link(name = "Security", kind = "framework"))] +#[cfg_attr( + any(target_os = "macos", target_os = "ios"), + link(name = "Security", kind = "framework") +)] extern "C" {} |