Skip to content

Commit 69d4299

Browse files
committed
This patch removes the initialization of ri in loop in
quote_postgres(...) in ecpglib.c. The code in CVS reads: quote_postgres(char *arg, int lineno) { char *res = (char *) ecpg_alloc(2 * strlen(arg) + 3, lineno); int i, ri = 0; if (!res) return (res); res[ri++] = '\''; for (i = 0, ri=0; arg[i]; i++, ri++) { switch (arg[i]) { case '\'': res[ri++] = '\''; break; case '\\': res[ri++] = '\\'; break; default: ; } The problem here is that ri is reset to 0, thus overwriting the initial quote. Stephen Birch
1 parent 2515882 commit 69d4299

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/interfaces/ecpg/lib/ecpglib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ quote_postgres(char *arg, int lineno)
238238
return (res);
239239

240240
res[ri++] = '\'';
241-
for (i = 0, ri = 0; arg[i]; i++, ri++)
241+
for (i = 0; arg[i]; i++, ri++)
242242
{
243243
switch (arg[i])
244244
{

0 commit comments

Comments
 (0)