Skip to content

Commit

Permalink
openssl-provider: Add null checks in init function
Browse files Browse the repository at this point in the history
out and provctx are double pointers. Check if the first level of
dereferencing is valid by testing for NULL pointers before
assigning the values.

Signed-off-by: Gowtham Suresh Kumar <[email protected]>
  • Loading branch information
gowthamsk-arm committed Mar 1, 2024
1 parent ec17350 commit b5d4271
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions parsec-openssl-provider/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,12 @@ pub unsafe fn parsec_provider_provider_init(
];
});

*out = DISPATCH_TABLE.as_ptr();
*provctx = std::ptr::null_mut();
if !out.is_null() {
*out = DISPATCH_TABLE.as_ptr();
}
if !provctx.is_null() {
*provctx = std::ptr::null_mut();
}

Ok(())
}
Expand Down

0 comments on commit b5d4271

Please sign in to comment.