Re: Usage of strncpy in the kernel

Martin Husemann <[email protected]>
Newsgroups gmane.os.netbsd.devel.kernel
Message-ID <[email protected]>
On Tue, Jan 07, 2025 at 07:58:11PM +0000, nia wrote:
> On Mon, Jan 06, 2025 at 03:23:45PM -0500, Mouse wrote:
> > No, that's not all.  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.)
> 
> Unfortunately modern compilers no longer guarantee this is true.

What are you refereing to?
The strncpy() semantics haven't changed in recent standards and the
changed union aggregate initialization rule is unrelated to strncpy.

Martin
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.