LWN.net Logo

The ups and downs of strlcpy()

The ups and downs of strlcpy()

Posted Jul 19, 2012 11:29 UTC (Thu) by cladisch (✭ supporter ✭, #50193)
In reply to: The ups and downs of strlcpy() by Ben_P
Parent article: The ups and downs of strlcpy()

x86 has several string instructions that essentially implement mem* functions: rep movs for memcpy(), repne scas for memchr(), rep stos for memset(), and repe cmps for memcmp().

As far as I can see, strcpy(), strncpy(), and strlcpy() could be implemented equally well on top of these primitives.


(Log in to post comments)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds