Why is strncpy insecure?

stimms picture stimms · May 15, 2009 · Viewed 53.4k times · Source

I am looking to find out why strncpy is considered insecure. Does anybody have any sort of documentation on this or examples of an exploit using it?

Answer

Tim picture Tim · May 15, 2009

Take a look at this site; it's a fairly detailed explanation. Basically, strncpy() doesn't require NUL termination, and is therefore susceptible to a variety of exploits.