Re: strncpy is not a safe version of strcpy

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: strncpy is not a safe version of strcpy
Дата
Msg-id 1384525968.71775.YahooMailNeo@web162905.mail.bf1.yahoo.com
обсуждение исходный текст
Ответ на Re: strncpy is not a safe version of strcpy  ("Tomas Vondra" <tv@fuzzy.cz>)
Список pgsql-hackers
Tomas Vondra <tv@fuzzy.cz> wrote:
> On 15 Listopad 2013, 1:00, David Rowley wrote:
>> more focused on trying to draw a bit of attention to commit
>> 061b88c732952c59741374806e1e41c1ec845d50 which uses strncpy and
>> does not properly set the last byte to 0 afterwards. I think
>> this case could just be replaced with strlcpy which does all
>> this hard work for us.
>
> Hmm, you mean this piece of code?
>
>   strncpy(saved_argv0, argv[0], MAXPGPATH);
>
> IMHO you're right that's probably broken, unless there's some
> checking happening before the call.


I agree, and there is no such checking.  Fix pushed.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Race condition in b-tree page deletion
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Logging WAL when updating hintbit