bryancall commented on code in PR #12613:
URL: https://github.com/apache/trafficserver/pull/12613#discussion_r2461682181
##########
include/tscore/ink_inet.h:
##########
@@ -323,9 +323,10 @@ inline void
ats_unix_append_id(sockaddr_un *s, int id)
{
char tmp[16];
- int cnt = snprintf(tmp, sizeof(tmp), "-%d", id);
- if (static_cast<size_t>(ats_unix_path_len(s) + cnt) < TS_UNIX_SIZE) {
- strncat(s->sun_path, tmp, cnt);
+ int cnt = snprintf(tmp, sizeof(tmp), "-%d", id);
Review Comment:
From Claude:
```
Buffer overflow: Impossible (snprintf guarantees this)
Negative return: Impossible (no encoding for integers)
Return > 16: Impossible (max is 12 + null = 13)
The check if (cnt < 0 || cnt >= static_cast<int>(sizeof(tmp))) is defensive
programming but will never trigger in practice. It's not harmful, but it's also
not strictly necessary for this specific case.
```
--
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]