mirror of
https://github.com/postgres/postgres.git
synced 2025-05-13 01:13:08 -04:00
Add missing string terminator
When copying the string strncpy won't add nul termination since the string length is equal to the length specified. Explicitly set a nul terminator after copying to properly terminate. Found via post-commit review. Author: Rahila Syed <rahilasyed90@gmail.com> Reviewed-by: Daniel Gustafsson <daniel@yesql.se> Discussion: https://postgr.es/m/CAH2L28vt16C9xTuK+K7QZvtA3kCNWXOEiT=gEekUw3Xxp9LVQw@mail.gmail.com
This commit is contained in:
parent
991407ae86
commit
d2a1ed1727
@ -1663,6 +1663,7 @@ ProcessGetMemoryContextInterrupt(void)
|
||||
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';
|
||||
meminfo[max_stats - 1].ident = InvalidDsaPointer;
|
||||
meminfo[max_stats - 1].path = InvalidDsaPointer;
|
||||
meminfo[max_stats - 1].type = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user