libpq crash fix [was: Provide a way to not ask for a password in psql] - Mailing list pgsql-bugs

From Martin Pitt
Subject libpq crash fix [was: Provide a way to not ask for a password in psql]
Date
Msg-id 20071009143202.GC7103@piware.de
Whole thread Raw
In response to Provide a way to not ask for a password in psql  (Martin Pitt <martin@piware.de>)
Responses Re: libpq crash fix [was: Provide a way to not ask for a password in psql]
List pgsql-bugs
Hi again,

Martin Pitt [2007-10-09 15:56 +0200]:
> (2) PGPASSFILE=/dev/null psql -l
>
>    With /dev/null I get a segfault (I'll probably send a patch for
>    that later).

Ah, it tried to free(pgpassfile) in PasswordFromFile(), but that is a
local stack variable.

Can you please apply this upstream?

Thanks,

Martin

--
Martin Pitt        http://www.piware.de
Ubuntu Developer   http://www.ubuntu.com
Debian Developer   http://www.debian.org
diff -Nur postgresql-8.3/build-tree/postgresql-8.3beta1/src/interfaces/libpq/fe-connect.c
postgresql-8.3.new/build-tree/postgresql-8.3beta1/src/interfaces/libpq/fe-connect.c
--- postgresql-8.3beta1/src/interfaces/libpq/fe-connect.c    2007-07-23 19:52:06.000000000 +0200
+++ postgresql-8.3beta1/src/interfaces/libpq/fe-connect.c    2007-10-09 16:22:41.000000000 +0200
@@ -3723,7 +3723,6 @@
         fprintf(stderr,
         libpq_gettext("WARNING: password file \"%s\" is not a plain file\n"),
                 pgpassfile);
-        free(pgpassfile);
         return NULL;
     }


Attachment

pgsql-bugs by date:

Previous
From: Martin Pitt
Date:
Subject: Provide a way to not ask for a password in psql
Next
From: Magnus Hagander
Date:
Subject: Re: libpq crash fix [was: Provide a way to not ask for a password in psql]