tech-kern archive

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

Re: Usage of strncpy in the kernel



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


Home | Main Index | Thread Index | Old Index