Re: Fix for bug in ldapServiceLookup in libpq

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Fix for bug in ldapServiceLookup in libpq
Дата
Msg-id 28650.1305129646@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Fix for bug in ldapServiceLookup in libpq  ("Albe Laurenz" <laurenz.albe@wien.gv.at>)
Список pgsql-hackers
"Albe Laurenz" <laurenz.albe@wien.gv.at> writes:
> I have found a small but annoying bug in libpq where
> connection parameters are resolved via LDAP.

> There is a write past the end of a malloc'ed string which causes
> memory corruption. The code and the bug are originally by me :^(

Hmm ... that's a bug all right, but why have the null-termination
inside the loop at all?  Seems like it should look like
for (p = result, i = 0; values[i] != NULL; ++i){    strncpy(p, values[i]->bv_val, values[i]->bv_len);    p +=
values[i]->bv_len;   *(p++) = '\n';}*p = '\0';
 

> This should be backpatched to 8.2 where the code was introduced.

Yes, will do.
        regards, tom lane


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

Предыдущее
От: "Kevin Grittner"
Дата:
Сообщение: Re: the big picture for index-only scans
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: VARIANT / ANYTYPE datatype