1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

lib/registry/regf: better initialise nk_block

We were initialising a uint32_t[5] block with memset(..., 5) when we
surely meant memset(..., 5 * sizeof(uint32_t)) or some equivalent.

Thanks go to gcc-7 and -Wmemset-elt-size. The warning looks like this:

../source4/lib/registry/regf.c: In function ‘reg_create_regf_file’:
../source4/lib/registry/regf.c:2095:2: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
  memset(nk.unk3, 0, 5);
    ^~~~~~

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Douglas Bagnall 2016-11-30 14:19:39 +13:00 committed by Ralph Boehme
parent f5154a86fa
commit 28eb49c7ed

View File

@ -2092,7 +2092,7 @@ WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx,
nk.unknown_offset = -1;
nk.num_values = 0;
nk.values_offset = -1;
memset(nk.unk3, 0, 5);
memset(nk.unk3, 0, 5 * sizeof(uint32_t));
nk.clsname_offset = -1;
nk.clsname_length = 0;
nk.sk_offset = 0x80;