tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Usage of strncpy in the kernel



>> 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		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index