Re: Problem with setlocale (found in libecpg) [accessing a memory location after freeing it] - Mailing list pgsql-patches

From Tom Lane
Subject Re: Problem with setlocale (found in libecpg) [accessing a memory location after freeing it]
Date
Msg-id 13272.1001794501@sss.pgh.pa.us
Whole thread Raw
In response to Re: Problem with setlocale (found in libecpg) [accessing a memory location after freeing it]  (Michael Meskes <meskes@postgresql.org>)
List pgsql-patches
Michael Meskes <meskes@postgresql.org> writes:
> You're partially right. Standard says "This  string  may  be allocated  in
> static storage." So, yes, with your patch we are on the safe side. I just
> committed the changes.

This patch wasn't right: setlocale(LC_NUMERIC, "C") returns a string
corresponding to the *new* locale setting, not the old one.  Therefore,
while the patched code failed to dump core, it also failed to restore
the previous locale setting as intended.  I have committed an updated
version.

            regards, tom lane

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: regression tests for pgcrypto
Next
From: Peter Eisentraut
Date:
Subject: Re: More fixes for missing double quotes in the shell