maskit commented on code in PR #12141: URL: https://github.com/apache/trafficserver/pull/12141#discussion_r2021879751
########## src/iocore/net/ProxyProtocol.cc: ########## @@ -291,7 +291,7 @@ proxy_protocol_v2_parse(ProxyProtocol *pp_info, const swoc::TextView &msg) } if (tlv_len > 0) { - if (pp_info->set_additional_data(msg.substr(msg.length() - tlv_len)) < 0) { + if (pp_info->set_additional_data(msg.substr(total_len - tlv_len, tlv_len)) < 0) { Review Comment: I think these lines ensure that the calculated value is always valid. ``` const size_t total_len = PPv2_CONNECTION_HEADER_LEN + len; if (msg.size() < total_len) { return 0; } tlv_len = len - PPv2_ADDR_LEN_INET; ``` -- 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: github-unsubscr...@trafficserver.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org