From: Pavel Filipenský Date: Wed, 11 Mar 2026 16:39:48 +0000 (+0100) Subject: lib/util: Overwrite talloc name in talloc_keep_secret() only if it would reveal memor... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af22b4de252a07cc690d1aaa811b9e3ac245489e;p=thirdparty%2Fsamba.git lib/util: Overwrite talloc name in talloc_keep_secret() only if it would reveal memory content Pair-Programmed-With: Stefan Metzmacher Signed-off-by: Pavel Filipenský --- diff --git a/lib/util/talloc_keep_secret.c b/lib/util/talloc_keep_secret.c index eb5bb80ff37..eb3d2588265 100644 --- a/lib/util/talloc_keep_secret.c +++ b/lib/util/talloc_keep_secret.c @@ -49,6 +49,12 @@ void _talloc_keep_secret(void *ptr, const char *name) return; } - talloc_set_name_const(ptr, name); + /* + * Overwrite talloc name only if it reveals memory content. + * That prevents breaking talloc_get_type_abort(). + */ + if (talloc_get_name(ptr) == ptr) { + talloc_set_name_const(ptr, name); + } talloc_set_destructor(ptr, talloc_keep_secret_destructor); }