summaryrefslogtreecommitdiffstats
path: root/lib/replace
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2013-11-28 09:33:59 +0100
committerDavid Disseldorp <ddiss@samba.org>2013-11-28 12:33:10 +0100
commit13550a2b5eed57084a5d9671d9493a9a2e08d7e3 (patch)
treee58b908a3036b343d117b4e3ee69ffdc9862dd31 /lib/replace
parente2db9c524f40f8771ae19b2be47a56f7a9d887af (diff)
downloadsamba-13550a2b5eed57084a5d9671d9493a9a2e08d7e3.tar.gz
samba-13550a2b5eed57084a5d9671d9493a9a2e08d7e3.tar.xz
samba-13550a2b5eed57084a5d9671d9493a9a2e08d7e3.zip
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>
Diffstat (limited to 'lib/replace')
-rw-r--r--lib/replace/replace.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/replace/replace.c b/lib/replace/replace.c
index 37edb310c59..effe5defe6c 100644
--- a/lib/replace/replace.c
+++ b/lib/replace/replace.c
@@ -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;