Re: Bug in canonicalize_path()

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: William ZHANG <uniware(at)zedware(dot)org>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Bug in canonicalize_path()
Date: 2005-08-12 03:07:06
Message-ID: 200508120307.j7C376c13707@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > And then you have this case:
>
> > /usr/local/../bin/../..
>
> AFAICS, the patch I just proposed handles this.
>
> If I recall the code properly, we do not have to make canonicalize_path
> remove embedded "." or ".." --- that is, we do not have to simplify
>
> /usr/local/../bin
>
> But we do have to get rid of every trailing "." or "..", else there are
> failure cases when we replace the trailing component with an ordinary
> file name.

But what about "usr/local/../../.."? You loop is similar to what I
coded, but then when I realized I had to check for pending trims after I
run out of directories, and start appending them to create things like
../.., I gave up.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2005-08-12 03:14:08 Re: Bug in canonicalize_path()
Previous Message Tom Lane 2005-08-12 03:01:05 Re: Bug in canonicalize_path()