On Wed, Jul 7, 2021 at 12:09 AM Martin K. Petersen wrote: > > > Sreekanth, > > > I verified strscpy() is not adding any null terminator when source > > string length is greater than destination buffer size. > > That's odd. The point of strscpy() is that it guarantees termination: > > ---8<--- > /** > * strscpy - Copy a C-string into a sized buffer > * @dest: Where to copy the string to > * @src: Where to copy the string from > * @count: Size of destination buffer > * > * Copy the string, or as much of it as fits, into the dest buffer. The > * behavior is undefined if the string buffers overlap. The destination > * buffer is always NUL terminated, unless it's zero-sized. > ---8<--- > > I tested it and it works fine for me. Ok, my bad. I made a small mistake while verifying it. Now I rectified it and saw that strscpy() is adding a NULL character at the end. Thanks, Sreekanth > > -- > Martin K. Petersen Oracle Linux Engineering