Re: pgsql: Add missing string terminator

Поиск
Список
Период
Сортировка
От Daniel Gustafsson
Тема Re: pgsql: Add missing string terminator
Дата
Msg-id 9887D3A8-A74F-4836-BC57-74AC4AE901BB@yesql.se
обсуждение исходный текст
Ответ на Re: pgsql: Add missing string terminator  (David Rowley <dgrowleyml@gmail.com>)
Ответы Re: pgsql: Add missing string terminator
Список pgsql-committers
> On 30 Apr 2025, at 12:57, David Rowley <dgrowleyml@gmail.com> wrote:
> 
> 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?

How about using strlcpy as suggested by Peter?

-                       strncpy(nameptr, "Remaining Totals", namelen);
-                       nameptr[namelen] = '\0';
+                       strlcpy(nameptr, "Remaining Totals", namelen + 1);

--
Daniel Gustafsson




В списке pgsql-committers по дате отправления: