Re: tsearch filenames unlikes special symbols and numbers

From: "Ben Tilly" <btilly(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Gregory Stark" <stark(at)enterprisedb(dot)com>, "Magnus Hagander" <magnus(at)hagander(dot)net>, "Oleg Bartunov" <oleg(at)sai(dot)msu(dot)su>, "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>, "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: tsearch filenames unlikes special symbols and numbers
Date: 2007-09-03 23:54:00
Message-ID: acc274b30709031654wf337c8fp79c93fea9f1c3328@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-hackers

On 9/3/07, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Gregory Stark <stark(at)enterprisedb(dot)com> writes:
> > "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
> >> I'm not convinced that . is issue-free. On most if not all versions of Unix,
> >> you are allowed to open a directory as a file and read the filenames it
> >> contains. While I don't say it'd be easy to manage that through
> >> tsearch, there's at least a potential for discovering the filenames
> >> present in . and .. --- how much do we care about that?
>
> > Actually I don't think that's true any more, most file systems on most Unixen
> > do not allow it. However it appears it's still the case for Solaris so it's
> > still a good point.
>
> Actually, now that I've woken up a bit more, it is not a problem as
> long as the tsearch code always appends some kind of file extension
> to what the user gives, such as ".dict". It'll be impossible to name
> "." or ".." with that addition.

I don't know what you're discussing well enough to know if this is
relevant, but what you just said is not always true. If there is any
way to pass arbitrary binary data into your function call, then
someone can pass in a string with nul in it. When that hits the OS
API, your appended .dict won't be seen as part of the filename.

(This is a common security oversight when calling C APIs from
higher-level languages such as Perl. See
http://artofhacking.com/files/phrack/phrack55/P55-07.TXT for more.)

[...]

Cheers,
Ben

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2007-09-04 00:01:48 Re: tsearch filenames unlikes special symbols and numbers
Previous Message Ben Tilly 2007-09-03 23:50:03 Re: tsearch filenames unlikes special symbols and numbers

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-09-03 23:55:30 Re: Hash index todo list item
Previous Message Ben Tilly 2007-09-03 23:50:03 Re: tsearch filenames unlikes special symbols and numbers