Re: Patch for str_numth() in PG 7.4 - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Patch for str_numth() in PG 7.4
Date
Msg-id 20090113005046.GQ4919@alvh.no-ip.org
Whole thread Raw
In response to Re: Patch for str_numth() in PG 7.4  (Andreas 'ads' Scherbaum <adsmail@wars-nicht.de>)
Responses Re: Patch for str_numth() in PG 7.4  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Andreas 'ads' Scherbaum wrote:
>
> Hello all,
>
> On Mon, 12 Jan 2009 22:55:32 +0100 Andreas 'ads' Scherbaum wrote:
>
> > I tracked the problem done to the function str_numth() in
> > src/backend/utils/adt/formatting.c. The fix (attached) is easy: i
> > stole the function code from the latest 8.0 version which looks fare
> > more sane in handling the string pointers.
>
> Now with the correct patch attached, thanks to anyone who pointed this
> out ;-)

This was fixed on 1.84 of formatting.c for 8.0 (but not backpatched for
no apparent reason), which also changed some other stuff in that file.
The complete patch is attached.

revision 1.84
date: 2005-01-12 22:40:13 -0300;  author: tgl;  state: Exp;  lines: +9 -7;
branches:  1.84.4;
Remove unportable assumption that it's okay to use the target buffer
of an sprintf() as a source string.  Demonstrably does not work with
recent gcc and/or glibc on some platforms.


--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Attachment

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Recovery Test Framework
Next
From: Bruce Momjian
Date:
Subject: Re: Documenting pglesslog