Fix an edge case with strlcat().

This commit is contained in:
Themaister 2011-04-11 21:28:03 +02:00
parent 0f0a4d0a5e
commit 079549cbd2

5
strl.c
View File

@ -41,7 +41,12 @@ size_t strlcat(char *dest, const char *source, size_t size)
{ {
size_t len = strlen(dest); size_t len = strlen(dest);
dest += len; dest += len;
if (len > size)
size = 0;
else
size -= len; size -= len;
return len + strlcpy(dest, source, size); return len + strlcpy(dest, source, size);
} }
#endif #endif