Re: pgsql: Add new escaping functions PQescapeLiteral and

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: pgsql: Add new escaping functions PQescapeLiteral and
Дата
Msg-id 603c8f071001210939o49ccd1c5u6c7d7c276452bc8a@mail.gmail.com
обсуждение исходный текст
Ответ на Re: pgsql: Add new escaping functions PQescapeLiteral and  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-committers
On Thu, Jan 21, 2010 at 12:37 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> rhaas@postgresql.org (Robert Haas) writes:
>> Add new escaping functions PQescapeLiteral and PQescapeIdentifier.
>
> Minor gripe: this loop test is unsafe:
>
> +       /* Scan the string for characters that must be escaped. */
> +       for (s = str; *s != '\0' && (s - str) < len; ++s)
>
> Should check len first, else you might be fetching a byte that isn't
> there.

Good catch.

> On a stylistic level, shouldn't as_ident be declared bool not int?

Stupid bool.  Real programmers use int, except when they just program
in assembly directly.

...Robert

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pgsql: Add new escaping functions PQescapeLiteral and
Следующее
От: rhaas@postgresql.org (Robert Haas)
Дата:
Сообщение: pgsql: Fix unsafe loop test, and declare as_ident as bool rather than