Copilot commented on code in PR #13242:
URL: https://github.com/apache/trafficserver/pull/13242#discussion_r3362699571


##########
src/proxy/http3/Http3Frame.cc:
##########
@@ -534,9 +537,10 @@ Http3FrameFactory::create(IOBufferReader &reader)
 std::shared_ptr<Http3Frame>
 Http3FrameFactory::fast_create(IOBufferReader &reader)
 {
-  uint8_t type_buf[FRAME_TYPE_MAX_BYTES]{};
-  reader.memcpy(type_buf, sizeof(type_buf));
-  Http3FrameType type = Http3Frame::type(type_buf, sizeof(type_buf));
+  uint8_t           type_buf[FRAME_TYPE_MAX_BYTES]{};
+  std::size_t const type_avail{std::min<std::size_t>(reader.read_avail(), 
sizeof(type_buf))};
+  reader.memcpy(type_buf, type_avail);
+  Http3FrameType type = Http3Frame::type(type_buf, type_avail);

Review Comment:
   `type_buf_len` is not defined here; this looks like a typo and will fail to 
compile. It should use the clamped length you computed (`type_avail`) so 
`memcpy()` doesn't request more bytes than available.



-- 
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