s3:lib: Use memcpy() in escape_ldap_string()
authorAndreas Schneider <asn@samba.org>
Wed, 9 May 2018 15:29:39 +0000 (17:29 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 17 May 2018 15:30:09 +0000 (17:30 +0200)
commitff7568daaeb19ff30f47f7f600ead247eaf4e826
treecf2ec9f255a383009eac14ca7f54349ca1353e11
parent7a00d90d668f53914ffe035c41a5e79e60b51521
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>
source3/lib/ldap_escape.c