1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-03 01:18:10 +03:00
samba-mirror/lib/talloc
Michael Tokarev 712117155e replace direct calls to memset_s() with commonly used macros
samba provides macros for zeroing various structures in memory,
and all code uses them instead of relying on memset_s().
However, a few places use memset_s() directly.  Replace these
usages with macros for consistency and to be able to replace
memset_s() easier.

A few notes.

Commit 03a50d8f7d "lib:util: Check memset_s() error
code in talloc_keep_secret_destructor()" (Aug-2022) added a check
for error return from memset_s().  This is the only place in whole
codebase which bothers about doing this.  But I've difficult time
figuring out the intention.  Was there a real case when this code
path is actually executed?

Commit 7658c9bf0a "lib:crypto: Remove redundant array
zeroing" (Nov-2023) removed the OTHER line from the two lines used
to zero memory in here.  Initially the code used both memset_s()
*and* ZERO_ARRAY_LEN(), the former has been removed.  This change
removes the other - memset_s(), reintroducing ZERO_ARRAY_LEN().
Here however, it's probably better to use BURN_PTR instead of
ZERO_ARRAY - in this place and a few lines above.

Commit 8dddea2ced "lib:talloc: Use memset_s() to avoid
the call gets optimized out" (Feb-2024) is a recent commit which
introduces memset_s().  However, it does not seem like it makes
any difference whatsoever for a testsuite, or that it actually
needs to clean up the memory to begin with.

We've quite an assortment of all this memory zeroing stuff.  Also
it is repeated in replace.h and memory.h (two sets in these files
are different but has big intersection).  I'd say, to fix this mess,
things from replace.h should be removed in favour of memory.h, and
necessary includes added, but this is for the next time.  We also
have lots of direct usages of memset_s() in heimdal code.

Cc: Joseph Sutton <josephsutton@catalyst.net.nz>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2025-01-02 17:01:30 +00:00
..
ABI talloc: release 2.4.2 2024-01-29 14:39:32 +00:00
compat
doc doc: Update doc about talloc vs malloc speed 2024-09-28 01:20:01 +00:00
man doc: Update doc about talloc vs malloc speed 2024-09-28 01:20:01 +00:00
web
configure configure/Makefile: export PYTHONHASHSEED=1 in all 'configure/Makefile' scripts 2022-03-29 22:32:32 +00:00
doxy.config
LICENSE talloc: Add LGPLv3 LICENSE file 2024-12-12 13:59:29 +00:00
Makefile Python: remove pydoctor 2023-02-02 21:15:54 +00:00
NEWS
pytalloc_guide.txt lib:talloc: Fix code spelling 2023-04-14 05:25:33 +00:00
pytalloc_private.h pytalloc: Add new BaseObject 2016-03-08 01:58:26 +01:00
pytalloc_util.c Use python.h from libreplace 2023-11-20 15:37:33 +00:00
pytalloc-util.pc.in talloc: use the system pytalloc-util for python3 as well 2017-03-10 07:31:10 +01:00
pytalloc.c Use python.h from libreplace 2023-11-20 15:37:33 +00:00
pytalloc.h Bug 9931: change pytalloc source to LGPL 2021-03-16 18:17:42 +00:00
talloc_guide.txt doc: Update doc about talloc vs malloc speed 2024-09-28 01:20:01 +00:00
talloc_testsuite.h
talloc.c talloc: Fix documentation 2023-12-08 02:28:33 +00:00
talloc.h talloc: Fix documentation 2023-10-25 22:23:37 +00:00
talloc.pc.in
test_magic_differs_helper.c talloc: Test that talloc magic differs between processes. 2015-10-09 23:15:06 +02:00
test_magic_differs.sh talloc: Improve testsuite by avoiding path issues 2016-03-08 01:58:26 +01:00
test_pytalloc.c Use python.h from libreplace 2023-11-20 15:37:33 +00:00
test_pytalloc.py talloc:pytest: remove tests that only test Python 2 2024-05-31 00:25:33 +00:00
testsuite_main.c
testsuite.c replace direct calls to memset_s() with commonly used macros 2025-01-02 17:01:30 +00:00
wscript lib:talloc: Use memset_s() to avoid the call gets optimized out 2024-09-28 00:11:34 +00:00