Page MenuHomeFreeBSD

LinuxKPI: Implement strscpy
ClosedPublic

Authored by wulf on Jul 2 2021, 11:41 PM.
Tags
None
Referenced Files
F149826078: D31005.id91753.diff
Fri, Mar 27, 9:57 AM
Unknown Object (File)
Sun, Mar 22, 2:32 AM
Unknown Object (File)
Thu, Mar 19, 5:51 AM
Unknown Object (File)
Wed, Mar 18, 4:48 AM
Unknown Object (File)
Fri, Mar 6, 12:09 PM
Unknown Object (File)
Sat, Feb 28, 7:33 AM
Unknown Object (File)
Jan 31 2026, 7:37 PM
Unknown Object (File)
Jan 29 2026, 2:01 AM

Details

Summary

strscpy copies the src string, or as much of it as fits, into the dst
buffer. The dst buffer is always NUL terminated, unless it's zero-sized.
strscpy returns the number of characters copied (not including the
trailing NUL) or -E2BIG if len is 0 or src was truncated.

Currently drm-kmod replaces strscpy with strncpy that is not quite
correct as strncpy does not NUL-terminate overflown strings and returns
different values on exit.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable