Clarify strlcpy size check

This commit is contained in:
Landon Curt Noll
2021-11-30 03:33:48 -08:00
parent c838798f04
commit c4e5007587

2
strl.c
View File

@@ -93,7 +93,7 @@ strlcpy(char * dst, const char * src, size_t dstsize)
/*
* perform the size limited copy and NUL terminate
*/
if (srclen > dstsize-1) {
if (srclen+1 > dstsize) {
memcpy(dst, src, dstsize-1);
dst[dstsize-1] = '\0';
#if defined(STRL_TEST)