Tony Nguyen wrote: >> Since the string pointed to by 'p' is 'l' bytes long, after the >> strncpy 'port_str' won't neccesarily be NUL terminated, which could >> cause atol to fail. > > I thought the prior bzero call would prevent that problem, especially if > we make sure 'p' doesn't advance past 'addr'. Or would you prefer should > be replacing it with "strlcpy(port_str, p, l + 1)" ?
No, you're right. The bzero should handle it. >> svc_getrpcinfo: >> >> I'm still wondering where the "12" in "buf[12]" comes from. It >> should either be documented, or a constant (one hopefully derived >> from whatever determines the length of the buffer). > > Yes, a constant would be more clear but I'm not sure what the optimal > size should be. The buffer holds either port number (2^16 value) or a > netid (currently limited to tcp, udp, tcp6, udp6) and an extra space. > Does 12 seems reasonable? 12 sounds fine, I would just like for it to be a #define with a comment explaining where it comes from. Dave