1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-18 05:01:01 +03:00

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 0eb23285a2.

Author: Feilong Meng <feelingmeng@foxmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/tencent_771178777C5BC17FCB7F7A1771CD1FFD5708@qq.com
This commit is contained in:
Michael Paquier
2025-12-17 08:58:58 +09:00
parent 0a90df58cf
commit 1d325ad99c

View File

@@ -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);