From 95528b284da570a45fe68324a00bd4f7b6f0249c Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Sat, 4 Sep 2021 19:55:04 +0530 Subject: [PATCH] src: remove unnecessary comment and add a CHECK in crypto_tls.cc Signed-off-by: Darshan Sen PR-URL: https://github.com/nodejs/node/pull/39991 Reviewed-By: Anna Henningsen --- src/crypto/crypto_tls.cc | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/crypto/crypto_tls.cc b/src/crypto/crypto_tls.cc index 398509bc5cefe6..3b646160800082 100644 --- a/src/crypto/crypto_tls.cc +++ b/src/crypto/crypto_tls.cc @@ -144,9 +144,6 @@ int NewSessionCallback(SSL* s, SSL_SESSION* sess) { return 0; // Serialize session - // TODO(@jasnell): An AllocatedBuffer or BackingStore would be better - // here to start eliminating unnecessary uses of Buffer where an ordinary - // Uint8Array would do just fine. Local session = Buffer::New(env, size).FromMaybe(Local()); if (UNLIKELY(session.IsEmpty())) return 0; @@ -154,16 +151,12 @@ int NewSessionCallback(SSL* s, SSL_SESSION* sess) { unsigned char* session_data = reinterpret_cast(Buffer::Data(session)); - memset(session_data, 0, size); - i2d_SSL_SESSION(sess, &session_data); + CHECK_EQ(i2d_SSL_SESSION(sess, &session_data), size); unsigned int session_id_length; const unsigned char* session_id_data = SSL_SESSION_get_id(sess, &session_id_length); - // TODO(@jasnell): An AllocatedBuffer or BackingStore would be better - // here to start eliminating unnecessary uses of Buffer where an ordinary - // Uint8Array would do just fine Local session_id = Buffer::Copy( env, reinterpret_cast(session_id_data),