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


##########
src/records/RecHttp.cc:
##########
@@ -368,10 +368,16 @@ HttpProxyPort::processOptions(const char *opts)
 
   for (auto item : values) {
     if (item[0] == '/') {
-      m_family    = AF_UNIX;
-      m_unix_path = UnAddr(item);
-      af_set_p    = true;
-      zret        = true;
+      if (size_t len = strlen(item); len >= TS_UNIX_SIZE) {
+        // A longer path would be silently truncated and the listener bound to 
the wrong
+        // filesystem path.
+        Warning("Unix path '%s' in port configuration '%s' is too long (%zu 
bytes, max %zu)", item, opts, len, TS_UNIX_SIZE - 1);
+      } else {
+        m_family    = AF_UNIX;
+        m_unix_path = UnAddr(item);
+        af_set_p    = true;
+        zret        = true;
+      }

Review Comment:
   When a unix socket path token is too long, this code only emits a Warning 
and then continues parsing the rest of the descriptor. That allows the same 
descriptor to become "valid" via later tokens (e.g. a numeric port), which can 
silently change the listener from the intended unix socket to an INET port. If 
the goal is to reject the over-long unix socket descriptor, the parse should 
fail immediately once the over-long path is detected.



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