strcpy -> strlcpy?

Matthew Dillon dillon at apollo.backplane.com
Sat Jan 1 11:04:00 PST 2005


:Is it worth changing strcpy to strlcpy?
:
:style(9) mentions this only for new code but it would be quite easy to
:fix the tree (as OpenBSD has).
:
:Cheers
:
:Steve

    I think the answer is 'yes', because it makes audits easier, but
    it's also very easy to make mistakes when doing such conversions
    (e.g. like accidently using sizeof(variable) where variable is a
    pointer rather then a buffer), so any such patches would have to
    be carefully reviewed.  Feed them slowly :-)

					-Matt
					Matthew Dillon 
					<dillon at xxxxxxxxxxxxx>





More information about the Kernel mailing list