From: Michael Paquier Date: Fri, 10 Apr 2026 02:17:30 +0000 (+0900) Subject: Zero-fill private_data when attaching an injection point X-Git-Tag: REL_18_4~76 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=35f41b29ff1dedf172552adb1a7fab124518eadc;p=thirdparty%2Fpostgresql.git Zero-fill private_data when attaching an injection point InjectionPointAttach() did not initialize the private_data buffer of the shared memory entry before (perhaps partially) overwriting it. When the private data is set to NULL by the caler, the buffer was left uninitialized. If set, it could have stale contents. The buffer is initialized to zero, so as the contents recorded when a point is attached are deterministic. Author: Sami Imseih Discussion: https://postgr.es/m/CAA5RZ0tsGHu2h6YLnVu4HiK05q+gTE_9WVUAqihW2LSscAYS-g@mail.gmail.com Backpatch-through: 17 --- diff --git a/src/backend/utils/misc/injection_point.c b/src/backend/utils/misc/injection_point.c index f795fc2563f..64f11d4ba93 100644 --- a/src/backend/utils/misc/injection_point.c +++ b/src/backend/utils/misc/injection_point.c @@ -336,6 +336,7 @@ InjectionPointAttach(const char *name, entry->library[INJ_LIB_MAXLEN - 1] = '\0'; strlcpy(entry->function, function, sizeof(entry->function)); entry->function[INJ_FUNC_MAXLEN - 1] = '\0'; + memset(entry->private_data, 0, INJ_PRIVATE_MAXLEN); if (private_data != NULL) memcpy(entry->private_data, private_data, private_data_size);