From: Michael Paquier Date: Tue, 16 Dec 2025 23:58:58 +0000 (+0900) Subject: Remove useless code in InjectionPointAttach() X-Git-Url: http://git.postgresql.org/gitweb/static/main.js?a=commitdiff_plain;h=1d325ad99cb2dec0e8b45ba36909ee0a497d2a57;p=postgresql.git Remove useless code in InjectionPointAttach() strlcpy() ensures that a target string is zero-terminated, so there is no need to enforce it a second time in this code. This simplification could have been done in 0eb23285a257. Author: Feilong Meng Reviewed-by: Chao Li Discussion: https://postgr.es/m/tencent_771178777C5BC17FCB7F7A1771CD1FFD5708@qq.com --- diff --git a/src/backend/utils/misc/injection_point.c b/src/backend/utils/misc/injection_point.c index 54a9fe8e163..4945da458b1 100644 --- a/src/backend/utils/misc/injection_point.c +++ b/src/backend/utils/misc/injection_point.c @@ -331,11 +331,8 @@ InjectionPointAttach(const char *name, /* Save the entry */ strlcpy(entry->name, name, sizeof(entry->name)); - entry->name[INJ_NAME_MAXLEN - 1] = '\0'; strlcpy(entry->library, library, sizeof(entry->library)); - entry->library[INJ_LIB_MAXLEN - 1] = '\0'; strlcpy(entry->function, function, sizeof(entry->function)); - entry->function[INJ_FUNC_MAXLEN - 1] = '\0'; if (private_data != NULL) memcpy(entry->private_data, private_data, private_data_size);