Re: Bug in canonicalize_path() - Mailing list pgsql-patches

From Tom Lane
Subject Re: Bug in canonicalize_path()
Date
Msg-id 4489.1123824598@sss.pgh.pa.us
Whole thread Raw
In response to Re: Bug in canonicalize_path()  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: Bug in canonicalize_path()  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: Bug in canonicalize_path()  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Tom Lane wrote:
>> ... it's part of the API contract of canonicalize_path() that it
>> will not return something with trailing "." or "..".

> OK, new patch which I think handles all cases.

> +     if (pending_strips > 0)
> +     {
> +         for (; pending_strips > 0; pending_strips--)
> +             strcat(path, "../");
> +         trim_trailing_separator(path);
> +     }

Uh, that hardly meets the API contract that I mentioned.  I think
we really have to throw an error if the path tries to ".." above
the starting point.  (Remember again that most of the uses of
this thing are dealing with absolute paths anyway, so this isn't
that big a deal.)

            regards, tom lane

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: remove BufferBlockPointers for speed and space
Next
From: "Dave Page"
Date:
Subject: Re: [HACKERS] For review: Server instrumentation patch