Re: contrib/ buffer paranoia

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Neil Conway <nconway(at)klamath(dot)dyndns(dot)org>
Cc: Alvaro Herrera <alvherre(at)atentus(dot)com>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: contrib/ buffer paranoia
Date: 2002-08-14 05:42:02
Message-ID: 200208140542.g7E5g2O02303@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


Your patch has been added to the PostgreSQL unapplied patches list at:

http://candle.pha.pa.us/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------

Neil Conway wrote:
> Alvaro Herrera <alvherre(at)atentus(dot)com> writes:
> > Neil Conway dijo:
> > > Alvaro Herrera <alvherre(at)atentus(dot)com> writes:
> > > > I think in dbase/dbf2pg.c the limit of 10 to pgdate should be 11
> > > > (snprintf counts the \0 at the end).
> > >
> > > Yes, but so does the array declaration itself: a char[10] can hold at
> > > most 9 characters plus the '\0' terminator. I think the original code
> > > is buggy: if the author wants to store 10 characters plus a terminator
> > > in the array, it should be declared as a char[11]. Using snprintf() of
> > > length 11 with a char[10] would allow for a one-character overrun.
> >
> > I agree. Maybe it worked out of pure luck (or some alignment magic).
> > But while you're at it, you can as well correct the bug.
>
> Ok, a revised patch is attached that fixes the off-by-one bug in
> dbase/dbf2pg.c
>
> Thanks for the code review.
>
> Cheers,
>
> Neil
>
> --
> Neil Conway <neilconway(at)rogers(dot)com>
> PGP Key ID: DB3C29FC

[ Attachment, skipping... ]

>
> ---------------------------(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) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2002-08-14 05:43:18 Re: libpgtcl modifications
Previous Message Gavin Sherry 2002-08-14 05:35:47 Re: [HACKERS] CREATE TEMP TABLE .... ON COMMIT