Skip to content

Commit

Permalink
Make sure we do not crash if session is null
Browse files Browse the repository at this point in the history
This was seen in testing when openssl tries to duplicate a context and
operation state fails (common). The old context is left with a null
session, but later on openssl tries to use it again.

Signed-off-by: Simo Sorce <[email protected]>
  • Loading branch information
simo5 committed Jun 12, 2024
1 parent d3cd256 commit e9c9202
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,11 +386,17 @@ static void session_free(P11PROV_SESSION *session)

CK_SESSION_HANDLE p11prov_session_handle(P11PROV_SESSION *session)
{
if (!session) {
return CK_INVALID_HANDLE;
}
return session->session;
}

CK_SLOT_ID p11prov_session_slotid(P11PROV_SESSION *session)
{
if (!session) {
return CK_UNAVAILABLE_INFORMATION;
}
return session->slotid;
}

Expand Down

0 comments on commit e9c9202

Please sign in to comment.