Skip to content

Commit

Permalink
tls-psk: check GetTlsPskByFullyQualifiedResourceNameCb against nullptr
Browse files Browse the repository at this point in the history
- check GetTlsPskByFullyQualifiedResourceNameCb callback for presence before
  calling the callback
  • Loading branch information
franku committed Sep 2, 2018
1 parent 3c2592f commit ed3d24e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/src/lib/tls_openssl_private.cc
Expand Up @@ -249,6 +249,10 @@ unsigned int TlsOpenSslPrivate::psk_server_cb(SSL *ssl,
GetTlsPskByFullyQualifiedResourceNameCb_t GetTlsPskByFullyQualifiedResourceNameCb =
reinterpret_cast<GetTlsPskByFullyQualifiedResourceNameCb_t>(
SSL_CTX_get_ex_data(openssl_ctx, TlsOpenSslPrivate::SslCtxExDataIndex::kTlsOpenSslPrivate));
if (!GetTlsPskByFullyQualifiedResourceNameCb) {
Dmsg0(100, "GetTlsPskByFullyQualifiedResourceNameCb not set for psk server callback\n");
return result;
}
if (GetTlsPskByFullyQualifiedResourceNameCb(identity, configured_psk)) {
int psklen = Bsnprintf((char *)psk_output, max_psk_len, "%s", configured_psk.c_str());
Dmsg1(100, "psk_server_cb. psk: %s.\n", psk_output);
Expand Down

0 comments on commit ed3d24e

Please sign in to comment.