1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-22 02:50:28 +03:00

replace: Don't run over dst in strlcat

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>
This commit is contained in:
Volker Lendecke 2013-11-28 09:33:59 +01:00 committed by David Disseldorp
parent e2db9c524f
commit 13550a2b5e

View File

@ -84,7 +84,7 @@ size_t rep_strlcpy(char *d, const char *s, size_t bufsize)
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;