Re: syntax error causes crafted data to be executed in shell

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: "Thomer M(dot) Gil" <postgresql(at)thomer(dot)com>, pgsql-bugs(at)postgresql(dot)org, Peter Eisentraut <peter_e(at)gmx(dot)net>
Subject: Re: syntax error causes crafted data to be executed in shell
Date: 2004-12-18 04:26:38
Message-ID: 200412180426.iBI4Qcm10807@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Tom, would you show an example of the change in behavior? I didn't
> > understand the details.
>
> In CVS tip:
>
> regression=# \N `touch wrong1` \i `touch wrong2`
> Invalid command \N. Try \? for help.
> : No such file or directory
> regression=#
>
> Both wrong1 and wrong2 are created. Thomer originally asserted that
> wrong1 shouldn't have been created, ie, we shouldn't have tried to
> evaluate the backticked "argument" to \N. I further suggest that it's
> not a good idea to even try to process the \i command. I'd prefer to
> see something like
>
> regression=# \N `touch wrong1` \i `touch wrong2`
> Invalid command \N. Try \? for help.
> Ignoring junk "`touch wrong1` \i `touch wrong2`"
> regression=#

So if a backslash command fails we discard the rest of the line? I
guess.

How did user data ever get to psql in this way?

--
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-bugs by date

  From Date Subject
Next Message Tony Caduto 2004-12-18 04:28:20 Postgresql 8.0 RC1 not using indexes
Previous Message Tom Lane 2004-12-18 04:21:38 Re: syntax error causes crafted data to be executed in shell