If "d" is not 0-terminated, the pure strlen will read beyond the end
of the given bufsize. strlcat in libbsd deliberately avoids this, so we
should do the same.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
be one more than the maximum resulting string length */
size_t rep_strlcat(char *d, const char *s, size_t bufsize)
{
- size_t len1 = strlen(d);
+ size_t len1 = strnlen(d, bufsiz);
size_t len2 = strlen(s);
size_t ret = len1 + len2;