Reply to post: Re: C / C++ compilers and libc could do this too

Rust in peace: Memory bugs in C and C++ code cause security issues so Microsoft is considering alternatives once again

Dan 55 Silver badge

Re: C / C++ compilers and libc could do this too

Stop using strncpy already!

It doesn't guarantee strings are null-terminated, unless you yourself make the buffer one byte larger, set that byte to 0, and are sure it's never going to be used.

Use strlcpy or strcpy_s (C11) instead.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon