]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:libnet: Fix format-truncation warning in samsync_ldif
authorAndreas Schneider <asn@samba.org>
Wed, 13 Jun 2018 15:56:59 +0000 (17:56 +0200)
committerKarolin Seeger <kseeger@samba.org>
Wed, 27 Jun 2018 08:34:21 +0000 (10:34 +0200)
error: ā€˜%s’ directive output may be truncated writing up to 255 bytes
into a region of size 250 [-Werror=format-truncation=]
    snprintf(homedir, sizeof(homedir), "/home/%s", username);
                                                  ^~   ~~~~~~~~

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/libnet/libnet_samsync_ldif.c

index 170231636e0d0f9aeca0c96d12def14f75dab2a7..e45a755a0279488b92d8c4de9a5f3b3db7ce8125 100644 (file)
@@ -646,7 +646,8 @@ static NTSTATUS fetch_account_info_to_ldif(TALLOC_CTX *mem_ctx,
                                           const char *suffix,
                                           int alloced)
 {
-       fstring username, logonscript, homedrive, homepath = "", homedir = "";
+       fstring username, logonscript, homedrive, homepath = "";
+       char homedir[262] = {0};
        fstring hex_nt_passwd, hex_lm_passwd;
        fstring description, profilepath, fullname, sambaSID;
        char *flags, *user_rdn;