Re: Avoid incomplete copy string (src/backend/access/transam/xlog.c)

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Avoid incomplete copy string (src/backend/access/transam/xlog.c)
Дата
Msg-id ZnjDoP_MZQefJfwJ@paquier.xyz
обсуждение исходный текст
Ответ на Avoid incomplete copy string (src/backend/access/transam/xlog.c)  (Ranier Vilela <ranier.vf@gmail.com>)
Список pgsql-hackers
On Sun, Jun 23, 2024 at 09:34:45PM -0300, Ranier Vilela wrote:
> It's not critical code, so I think it's ok to use strlen, even because the
> result of strlen will already be available using modern compilers.
>
> So, I think it's ok to use memcpy with strlen + 1.

It seems to me that there is a pretty good argument to just use
strlcpy() for the same reason as the one you cite: this is not a
performance-critical code, and that's just safer.
--
Michael

Вложения

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: replace strtok()
Следующее
От: Gurjeet Singh
Дата:
Сообщение: Proposal: Division operator for (interval / interval => double precision)