Re: Usage of strncpy in the kernel

Mouse <[email protected]>
Newsgroups gmane.os.netbsd.devel.kernel
Message-ID <[email protected]>
>> It also fills the rest, if any, of the destination space with more
>> NULs.  (This can be useful to, for example, prevent leaking kernel
>> stack trash to userland.)
> That's what strncpy() does over and above what strlcpy() does.

*blush*  As if we needed more evidence that the issue confuses people!

> Your idea about a wrapper to do the termination is interesting, but
> it's not one defined by any existing standard, and as such in some
> sense it actually hides the intention too much.

No more so than various other NetBSD-specific idioms in the kernel.
(As a personal example, I find the <sys/queue.h> macros a substantial
impediment to understanding code - while admittedly I don't know
whether they are shared with other OS projects, in my limited
experience they are NetBSD-specific.)

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		[email protected]
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.