Re: pgsql: Add new escaping functions PQescapeLiteral and - Mailing list pgsql-committers

From Tom Lane
Subject Re: pgsql: Add new escaping functions PQescapeLiteral and
Date
Msg-id 10384.1264095443@sss.pgh.pa.us
Whole thread Raw
In response to pgsql: Add new escaping functions PQescapeLiteral and  (rhaas@postgresql.org (Robert Haas))
Responses Re: pgsql: Add new escaping functions PQescapeLiteral and
List pgsql-committers
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.

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

            regards, tom lane

pgsql-committers by date:

Previous
From: rhaas@postgresql.org (Robert Haas)
Date:
Subject: pgsql: Add new escaping functions PQescapeLiteral and
Next
From: Robert Haas
Date:
Subject: Re: pgsql: Add new escaping functions PQescapeLiteral and