Skip to content

Commit 95528b2

Browse files
RaisinTenBethGriggs
authored andcommittedSep 21, 2021
src: remove unnecessary comment and add a CHECK in crypto_tls.cc
Signed-off-by: Darshan Sen <darshan.sen@postman.com> PR-URL: #39991 Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 8d5787a commit 95528b2

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed
 

‎src/crypto/crypto_tls.cc

+1-8
Original file line numberDiff line numberDiff line change
@@ -144,26 +144,19 @@ int NewSessionCallback(SSL* s, SSL_SESSION* sess) {
144144
return 0;
145145

146146
// Serialize session
147-
// TODO(@jasnell): An AllocatedBuffer or BackingStore would be better
148-
// here to start eliminating unnecessary uses of Buffer where an ordinary
149-
// Uint8Array would do just fine.
150147
Local<Object> session = Buffer::New(env, size).FromMaybe(Local<Object>());
151148
if (UNLIKELY(session.IsEmpty()))
152149
return 0;
153150

154151
unsigned char* session_data =
155152
reinterpret_cast<unsigned char*>(Buffer::Data(session));
156153

157-
memset(session_data, 0, size);
158-
i2d_SSL_SESSION(sess, &session_data);
154+
CHECK_EQ(i2d_SSL_SESSION(sess, &session_data), size);
159155

160156
unsigned int session_id_length;
161157
const unsigned char* session_id_data =
162158
SSL_SESSION_get_id(sess, &session_id_length);
163159

164-
// TODO(@jasnell): An AllocatedBuffer or BackingStore would be better
165-
// here to start eliminating unnecessary uses of Buffer where an ordinary
166-
// Uint8Array would do just fine
167160
Local<Object> session_id = Buffer::Copy(
168161
env,
169162
reinterpret_cast<const char*>(session_id_data),

0 commit comments

Comments
 (0)
Please sign in to comment.