From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Peter Eisentraut <peter_e(at)gmx(dot)net>, Florian Weimer <Florian(dot)Weimer(at)RUS(dot)Uni-Stuttgart(dot)DE>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Re: Escaping strings for inclusion into SQL queries |
Date: | 2001-09-07 20:16:48 |
Message-ID: | 200109072016.f87KGmh21495@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Has this been resolved?
> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> > Tom Lane writes:
> >> I don't follow. xddouble can only expand to two quote marks, so how
> >> does it matter which one we use as the result?
>
> > addlit() expects the first argument to be null-terminated and implicitly
> > uses that null byte at the end of the supplied argument to terminate its
> > own buffer.
>
> Hmm, so I see:
>
> /* append data --- note we assume ytext is null-terminated */
> memcpy(literalbuf+literallen, ytext, yleng+1);
> literallen += yleng;
>
> Given that we are passing the length of the desired string, it seems
> bug-prone for addlit to *also* expect null termination. I'd suggest
>
> memcpy(literalbuf+literallen, ytext, yleng);
> literallen += yleng;
> literalbuf[literallen] = '\0';
>
> instead.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://www.postgresql.org/search.mpl
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2001-09-07 20:17:34 | Re: Changelog and 7.1.3 release |
Previous Message | Bruce Momjian | 2001-09-07 20:13:09 | Re: PATCH proposed with new features for CREATE TABLE |