From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Ed Loehr <pgpatches(at)bluepolka(dot)net> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: 7.2 fe-exec.c patch to PQescapeString() |
Date: | 2002-04-05 12:13:04 |
Message-ID: | 200204051213.g35CD4O03323@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
I am not sure about this patch. If they pass NULL as string pointers,
but a positive length, I think we should crash rather than assuming
everything is OK. The code already works OK for length = 0. In fact,
the patch makes length=0 do nothing, rather than having it execute this
line:
/* Write the terminating NUL character. */
*target = '\0';
---------------------------------------------------------------------------
Ed Loehr wrote:
> This patch makes PQescapeString() guard against null input
>
> ptrs and/or length == 0 input. If any of these occur, the
>
> function returns 0.
>
> *** fe-exec.c.orig Thu Apr 4 16:06:38 2002
> --- fe-exec.c Thu Apr 4 16:07:30 2002
> ***************
> *** 75,76 ****
> --- 75,80 ----
>
> + if ( ! to || ! from || ! length ) {
> + return 0;
> + }
> +
> while (remaining > 0)
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
--
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 | Tom Lane | 2002-04-05 15:18:58 | Re: PQescapeBytea is not multibyte aware |
Previous Message | Bruce Momjian | 2002-04-05 12:02:01 | Re: please apply patch - build on Unixware with GCC |