s3:lib: Use memcpy() in escape_ldap_string()
authorAndreas Schneider <asn@samba.org>
Wed, 9 May 2018 15:29:39 +0000 (17:29 +0200)
committerKarolin Seeger <kseeger@samba.org>
Wed, 20 Jun 2018 07:22:24 +0000 (09:22 +0200)
commitaff126166a1539504e0d471b890f28d21f649648
tree19f2be48bb989c728d39f772938806b7bc057917
parent3ef6d6ab6dc1d8f220d0d9e3c8e47af682f3e115
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)
source3/lib/ldap_escape.c