summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2018-05-09 17:29:39 +0200
committerKarolin Seeger <kseeger@samba.org>2018-06-27 10:34:21 +0200
commit992faaaffe6ed495cb88da5fe9669f82dbc59357 (patch)
tree28904b8c281aa6ca0e48344edc82ce24c96d0066 /source3
parent7cf1573dec15fa806cf3b5265a86f74d8a1d77cc (diff)
downloadsamba-992faaaffe6ed495cb88da5fe9669f82dbc59357.tar.gz
s3:lib: Use memcpy() in escape_ldap_string()
../source3/lib/ldap_escape.c: In function ‘escape_ldap_string’: ../source3/lib/ldap_escape.c:79:4: error: ‘strncpy’ output truncated before terminating nul copying 3 bytes from a string of the same length [-Werror=stringop-truncation] strncpy (p, sub, 3); ^~~~~~~~~~~~~~~~~~~ We concatenat and do not care about NUL-termination till the loop has finished. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13437 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org> (cherry picked from commit ff7568daaeb19ff30f47f7f600ead247eaf4e826)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/ldap_escape.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/source3/lib/ldap_escape.c b/source3/lib/ldap_escape.c
index fa75dabcae6..0d2b8f5fe01 100644
--- a/source3/lib/ldap_escape.c
+++ b/source3/lib/ldap_escape.c
@@ -76,7 +76,7 @@ char *escape_ldap_string(TALLOC_CTX *mem_ctx, const char *s)
output = tmp;
p = &output[i];
- strncpy (p, sub, 3);
+ memcpy(p, sub, 3);
p += 3;
i += 3;