bneradt commented on code in PR #13519:
URL: https://github.com/apache/trafficserver/pull/13519#discussion_r3738789666


##########
src/iocore/net/quic/QUICTypes.cc:
##########
@@ -723,17 +723,22 @@ QUICConnectionId::ZERO()
   return QUICConnectionId(zero, 0);
 }
 
-QUICConnectionId::QUICConnectionId()
-{
-  this->randomize();
-}
-
 QUICConnectionId::QUICConnectionId(const uint8_t *buf, uint8_t len) : _len(len)
 {
   ink_assert(len <= QUICConnectionId::MAX_LENGTH);
   memcpy(this->_id, buf, std::min(static_cast<int>(len), 
QUICConnectionId::MAX_LENGTH));
 }
 
+QUICConnectionId
+QUICConnectionId::random()
+{
+  uint8_t id[MAX_LENGTH] = {0};
+
+  ink_release_assert(SCID_LEN <= MAX_LENGTH);
+  ink_release_assert(RAND_bytes(id, SCID_LEN) == 1);
+  return {id, SCID_LEN};
+}

Review Comment:
   Addressed. random() now snapshots SCID_LEN once, uses that value throughout 
the operation, and directly returns ZERO() for a zero-length CID. Zero-length 
coverage was also added.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to