diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 9f4ac37448b328..f33b885ff47507 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -1410,10 +1410,13 @@ int SSLWrap::NewSessionCallback(SSL* s, SSL_SESSION* sess) { memset(serialized, 0, size); i2d_SSL_SESSION(sess, &serialized); + unsigned int session_id_length; + const unsigned char* session_id = SSL_SESSION_get_id(sess, + &session_id_length); Local session = Buffer::Copy( env, - reinterpret_cast(sess->session_id), - sess->session_id_length).ToLocalChecked(); + reinterpret_cast(session_id), + session_id_length).ToLocalChecked(); Local argv[] = { session, buff }; w->new_session_wait_ = true; w->MakeCallback(env->onnewsession_string(), arraysize(argv), argv);