4 ms·
Interesting to see the implementation is basically a two-pass process: strlen() to count the source string, followed by a memcpy(). My intuition would be to gi
by zbuf 3y ago
Interesting to see the implementation is basically a two-pass process: strlen() to count the source string, followed by a memcpy().
My intuition would be to give some importance to not looping on the source string radically beyond the length of the destination buffer.
https://sourceware.org/git/?p=glibc.git;a=blob;f=string/strlcpy.c;h=7a0df3ebb6b279cf151daf14a8cde3b43e705f6c;hb=454a20c8756c9c1d55419153255fc7692b3d2199 https://sourceware.org/git/?p=glibc.git;a=blob;f=string/strl...