Re: Re: [PATCHES] Fw: Isn't pg_statistic a security hole - Solution Proposal

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Joe Conway" <joseph(dot)conway(at)home(dot)com>
Cc: "Peter Eisentraut" <peter_e(at)gmx(dot)net>, "PostgreSQL Development" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Re: [PATCHES] Fw: Isn't pg_statistic a security hole - Solution Proposal
Date: 2001-06-14 01:27:20
Message-ID: 15724.992482040@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

"Joe Conway" <joseph(dot)conway(at)home(dot)com> writes:
> I'll rework the patch per the above and resend.

Too late ;-). I just finished ripping out the unneeded parts and
applying.

I made a few minor changes too, mostly removing unnecessary code
(you don't need to call nameout, everyone else just uses NameStr)
and trying to line up stylistically with other code. One actual
bug noted: you were doing this in a couple of places:

+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(reloid), 0, 0, 0);
+ if (!HeapTupleIsValid(tuple)) {
+ elog(ERROR, "has_table_privilege: invalid relation oid %d", (int) reloid);
+ }
+
+ relname = NameStr(((Form_pg_class) GETSTRUCT(tuple))->relname);
+
+ ReleaseSysCache(tuple);

Since relname is just a pointer into the tuple, expecting it to still
be valid after you release the syscache entry is not kosher. There are
several ways to deal with this, but what I actually did was to make use
of lsyscache.c's get_rel_name, which pstrdup()s its result to avoid this
trap.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2001-06-14 01:37:00 Re: Re: [PATCHES] Fw: Isn't pg_statistic a security hole - Solution Proposal
Previous Message chris.bitmead 2001-06-14 01:21:46 Re: [PATCHES] Australian timezone configure option

Browse pgsql-patches by date

  From Date Subject
Next Message Joe Conway 2001-06-14 01:37:00 Re: Re: [PATCHES] Fw: Isn't pg_statistic a security hole - Solution Proposal
Previous Message Tom Lane 2001-06-14 01:20:30 Re: Australian timezone configure option