s3:passdb: Fix size of ascii_p16
authorAndreas Schneider <asn@samba.org>
Wed, 9 May 2018 16:05:01 +0000 (18:05 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 17 May 2018 15:30:09 +0000 (17:30 +0200)
../source3/passdb/pdb_smbpasswd.c: In function ‘mod_smbfilepwd_entry’:
../source3/passdb/pdb_smbpasswd.c:1015:7: error: ‘:LCT-’ directive
    output may be truncated writing 5 bytes into a region of size between 0
    and 255 [-Werror=format-truncat ion=]
    "%s:LCT-%08X:",
       ^~~~~
../source3/passdb/pdb_smbpasswd.c:1015:4: note: using the range [0,
    4294967295] for directive argument
    "%s:LCT-%08X:",
    ^~~~~~~~~~~~~~
In file included from ../source3/include/includes.h:23,
                 from ../source3/passdb/pdb_smbpasswd.c:23:
../lib/replace/../replace/replace.h:514:18: note: ‘snprintf’ output
    between 15 and 270 bytes into a destination of size 255
 #define slprintf snprintf
../source3/passdb/pdb_smbpasswd.c:1013:3: note: in expansion of macro ‘slprintf’
   slprintf(&ascii_p16[strlen(ascii_p16)],
   ^~~~~~~~

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/passdb/pdb_smbpasswd.c

index 8a3d48b998009753c14bb8c69daf2785a2ba18e8..2615cbdd78813066b34b1914d5542cb68a8a3dc5 100644 (file)
@@ -741,7 +741,7 @@ static bool mod_smbfilepwd_entry(struct smbpasswd_privates *smbpasswd_state, con
        char linebuf[LINEBUF_SIZE + 1];
        char readbuf[1024];
        int c;
-       fstring ascii_p16;
+       char ascii_p16[FSTRING_LEN + 20];
        fstring encode_bits;
        unsigned char *p = NULL;
        size_t linebuf_len = 0;