From: Martin Pitt <martin@piware.de>
To: pgsql-bugs@postgresql.org
To: pgsql-odbc@postgresql.org
Subject: Re: Fix for buffer overflow ready [was: Fwd: Bug#247306: odbc-postgresql: SIGSEGV with long inputs (> 10000 bytes)]
Date: Fri, 14 May 2004 01:52:29 +0200
Message-ID: <20040513235229.GB29063@web08.manitu.net> (raw)
In-Reply-To: <200405131943.09803.peter_e@gmx.net>
References: <20040511100357.GA23102@ifsr.de>
<20040513094155.GA28717@ifsr.de>
<200405131943.09803.peter_e@gmx.net>
Hi!
On 2004-05-13 19:43 +0200, Peter Eisentraut wrote:
> Silently truncating various pieces of information is probably not the
> right thing.
But IMHO still better than overwriting arbitrary other data and code.
If an user supplies bogus input, he cannot expect to get something
sane out.
> What are you truncating?
By now:
- DSN, username, password, and the whole connection string;
- table names in info.c:
make_string(szTableName, cbTableName, pktab, sizeof(pktab));
- Two calls in info.c:
make_string(szPkTableName, cbPkTableName, pk_table_needed, sizeof(pk_table_needed));
make_string(szFkTableName, cbFkTableName, fk_table_needed, sizeof(fk_table_needed));
If these values should not be truncated, then psqlodbc should not use
fixed buffer sizes. Currently truncating them is way more sane than
letting them mess up the whole memory.
> If it's a query string you might open yourself up to SQL-injection
> type problems.
I don't think that the patch affects whole query strings, but of
course I may be wrong. The point of this patch was to fix the most
apparent overflows with least possible changes, and after a week of
silence on the lists I just had to do something about it. And now at
least the connection and exec methods seem to work safely.
> Plus, the ODBC driver appears to have buffer overruns all over the
> place. We need to replace every instance of strcpy, strcat, sprintf,
> make_string, and the various other feeble attempts with pqexpbuffer
> from libpq. That's the only way to solve this problem once and for
> all.
I would be glad if the next psqlodbc version would be written in a
sane way, without fixed string lengths and with a clear and safe
string "class" interface. But doing this is far beyond the scope of a
security patch (especially for Debian stable).
One question: which mailing list is the better place to discuss this?
-odbc or -bugs?
Thanks and have a nice day!
Martin
--
Martin Pitt Debian GNU/Linux Developer
martin@piware.de mpitt@debian.org
http://www.piware.dehttp://www.debian.org
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: martin@piware.de, pgsql-bugs@postgresql.org
Subject: Re: Fix for buffer overflow ready [was: Fwd: Bug#247306: odbc-postgresql: SIGSEGV with long inputs (> 10000 bytes)]
In-Reply-To: <20040513235229.GB29063@web08.manitu.net>
References: <20040511100357.GA23102@ifsr.de> <20040513094155.GA28717@ifsr.de> <200405131943.09803.peter_e@gmx.net> <20040513235229.GB29063@web08.manitu.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox