maskit commented on code in PR #12961:
URL: https://github.com/apache/trafficserver/pull/12961#discussion_r2934383322
##########
src/iocore/net/NetVConnection.cc:
##########
@@ -53,9 +54,17 @@ DbgCtl dbg_ctl_ssl{"ssl"};
bool
NetVConnection::has_proxy_protocol(IOBufferReader *reader)
{
- char buf[PPv1_CONNECTION_HEADER_LEN_MAX + 1];
swoc::TextView tv;
- tv.assign(buf, reader->memcpy(buf, sizeof(buf), 0));
+
+ char preface[PPv2_CONNECTION_HEADER_LEN];
+ tv.assign(preface, reader->memcpy(preface, sizeof(preface), 0));
+ if (!proxy_protocol_detect(tv)) {
+ return false;
+ }
+
+ int bufsize =
RecGetRecordInt("proxy.config.proxy_protocol.max_header_size").value_or(PPv1_CONNECTION_HEADER_LEN_MAX
+ 1);
+ char buf[bufsize];
+ tv.assign(buf, reader->memcpy(buf, bufsize, 0));
Review Comment:
We decided to use variable-length arrays, and the value never be negative or
even 0.
--
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]