mirror of
https://github.com/postgres/postgres.git
synced 2026-02-14 00:03:18 -05:00
Convert strncpy to strlcpy
We try to avoid using strncpy() due to the ease of which it can be misused. Convert this callsite to use strlcpy() instead to match similar codepaths in this file. Suggested-by: Peter Eisentraut <peter@eisentraut.org> Discussion: https://postgr.es/m/2a796830-de2d-4030-b480-d673f6cc5d94@eisentraut.org
This commit is contained in:
parent
2d6745a66b
commit
45e7e8ca9e
1 changed files with 1 additions and 2 deletions
|
|
@ -1664,8 +1664,7 @@ ProcessGetMemoryContextInterrupt(void)
|
|||
num_individual_stats = context_id + 1;
|
||||
meminfo[max_stats - 1].name = dsa_allocate(MemoryStatsDsaArea, namelen + 1);
|
||||
nameptr = dsa_get_address(MemoryStatsDsaArea, meminfo[max_stats - 1].name);
|
||||
strncpy(nameptr, "Remaining Totals", namelen);
|
||||
nameptr[namelen] = '\0';
|
||||
strlcpy(nameptr, "Remaining Totals", namelen + 1);
|
||||
meminfo[max_stats - 1].ident = InvalidDsaPointer;
|
||||
meminfo[max_stats - 1].path = InvalidDsaPointer;
|
||||
meminfo[max_stats - 1].type = 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue