Re: Coding note: truncating with strlcpy() is not such a hot idea

Поиск
Список
Период
Сортировка
От Noah Misch
Тема Re: Coding note: truncating with strlcpy() is not such a hot idea
Дата
Msg-id 20151222065348.GA2556345@tornado.leadboat.com
обсуждение исходный текст
Ответ на Coding note: truncating with strlcpy() is not such a hot idea  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Mon, Dec 21, 2015 at 03:47:56PM -0500, Tom Lane wrote:
> 1. Using strlcpy to copy from sources that are not known null-terminated
> is outright unsafe: someday, you'll fall off the end of memory and
> SIGSEGV.
> 
> 2. Even with a known null-terminated string, using strlcpy to chop small
> pieces out of it is not bright, because each call will traverse all the
> rest of the input.  This means for example that extracting N words out
> of a long string will spend O(N^2) time in strlcpy.

Good points.



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

Предыдущее
От: Amit Langote
Дата:
Сообщение: Re: Foreign join pushdown vs EvalPlanQual
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: WIP: Fix parallel workers connection bug in pg_dump (Bug #13727)