mirror of
https://github.com/samba-team/samba.git
synced 2025-01-06 13:18:07 +03:00
bf16cd72b2
The correct line should have been talloc_realloc(ndr->current_mem_ctx, a, const char *, count + 2); because if the loop does not increment count on exit (it exits via break), so count is left pointing at the thing that just got put in. i.e., if there was one item it is at a[0], count is 0, but we also need the trailing NULL byte at a[1] and the length is 2. Thus + 2, not + 1. This will not affect ordinary (that is, non-malicious) traffic, because talloc_realloc will not actually realloc unless it is saving a kilobyte. Since the allocation grows slowly with the exponent ~1.25, the actual reallocs will start happening at some point between 512 and 1024 items. In the example we have, there were 666 pointers, and space for 824 was allocated. Rather than doing the +2 realloc, it is simpler to leave it off altogether; in the common case (<512 items) it is a no-op anyway, and in the best possible case it reduces the temporary array by 20%. Credit to OSS-Fuzz. REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=24646 Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> |
||
---|---|---|
.. | ||
libndr.h | ||
ndr_auth.c | ||
ndr_auth.h | ||
ndr_backupkey.c | ||
ndr_backupkey.h | ||
ndr_basic.c | ||
ndr_bkupblobs.c | ||
ndr_cab.c | ||
ndr_cab.h | ||
ndr_compression.c | ||
ndr_compression.h | ||
ndr_dcerpc.c | ||
ndr_dcerpc.h | ||
ndr_dns_utils.c | ||
ndr_dns_utils.h | ||
ndr_dns.c | ||
ndr_dns.h | ||
ndr_dnsp.c | ||
ndr_dnsp.h | ||
ndr_dnsserver.c | ||
ndr_dnsserver.h | ||
ndr_drsblobs.c | ||
ndr_drsblobs.h | ||
ndr_drsuapi.c | ||
ndr_drsuapi.h | ||
ndr_frsrpc.c | ||
ndr_frsrpc.h | ||
ndr_ioctl.c | ||
ndr_krb5pac.c | ||
ndr_krb5pac.h | ||
ndr_misc.c | ||
ndr_nbt.c | ||
ndr_nbt.h | ||
ndr_negoex.c | ||
ndr_negoex.h | ||
ndr_netlogon.c | ||
ndr_netlogon.h | ||
ndr_ntlmssp.c | ||
ndr_ntlmssp.h | ||
ndr_ntprinting.c | ||
ndr_ntprinting.h | ||
ndr_orpc.c | ||
ndr_preg.c | ||
ndr_preg.h | ||
ndr_rap.c | ||
ndr_rap.h | ||
ndr_schannel.c | ||
ndr_schannel.h | ||
ndr_sec_helper.c | ||
ndr_spoolss_buf.c | ||
ndr_spoolss_buf.h | ||
ndr_string.c | ||
ndr_svcctl.c | ||
ndr_svcctl.h | ||
ndr_table.c | ||
ndr_table.h | ||
ndr_witness.c | ||
ndr_witness.h | ||
ndr_wmi.c | ||
ndr_wmi.h | ||
ndr_xattr.c | ||
ndr_xattr.h | ||
ndr.c | ||
util.c | ||
uuid.c |