Re: pgsql: Add missing string terminator
От | David Rowley |
---|---|
Тема | Re: pgsql: Add missing string terminator |
Дата | |
Msg-id | CAApHDvrg3Gz6kF76Feyc6Dyi9u7iS+vcdQw3VZgGA1+wUc=wRQ@mail.gmail.com обсуждение исходный текст |
Ответ на | pgsql: Add missing string terminator (Daniel Gustafsson <dgustafsson@postgresql.org>) |
Ответы |
Re: pgsql: Add missing string terminator
|
Список | pgsql-committers |
On Wed, 30 Apr 2025 at 21:36, Daniel Gustafsson <dgustafsson@postgresql.org> wrote: > Add missing string terminator A possible minor niggle. Would memcpy not be a more suitable function for this? It's just there've been a few efforts in the past to try and minimise the usage of strncpy(). There should really just be a small handful of cases where the strange behaviour of that function is needed. I don't think this is one of those cases. Maybe something like the following would suit better? #define REMAINING_TOTALS "Remaining Totals" num_individual_stats = context_id + 1; meminfo[max_stats - 1].name = dsa_allocate(MemoryStatsDsaArea, sizeof(REMAINING_TOTALS)); nameptr = dsa_get_address(MemoryStatsDsaArea, meminfo[max_stats - 1].name); memcpy(nameptr, REMAINING_TOTALS, sizeof(REMAINING_TOTALS)); David
В списке pgsql-committers по дате отправления: