> some of these strings gets passed down on ioctls, so it may 
> not be properly null-terminated, hence the precaution. 

The first thing any ioctl handler does is validate arguments and 
immediately return EINVAL if something's wrong. That could include cases 
with strings that are not nul-terminated. The advantage is that the rest 
of the code doesn't have to worry about it.

And the data structures that permanently live in the kernel don't even 
have that excuse. E.g. are any of the [L]IFNAMESIZ-length char arrays 
not nul-terminated?

Not a big deal perhaps, but based on numerous past experiences, I 
instinctively become alert every time I see strn...

-Artem

Reply via email to