Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YBnSG-0001ne-My for pgsql-odbc@arkaria.postgresql.org; Thu, 15 Jan 2015 16:39:32 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YBnSG-0003Lb-7Q for pgsql-odbc@arkaria.postgresql.org; Thu, 15 Jan 2015 16:39:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YBnSE-0003KT-AM for pgsql-odbc@postgresql.org; Thu, 15 Jan 2015 16:39:30 +0000 Received: from outmail149056.authsmtp.com ([62.13.149.56]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YBnS4-0005ZT-3U for pgsql-odbc@postgresql.org; Thu, 15 Jan 2015 16:39:28 +0000 Received: from mail-c235.authsmtp.com (mail-c235.authsmtp.com [62.13.128.235]) by punt17.authsmtp.com (8.14.2/8.14.2/) with ESMTP id t0FGdIO7003869; Thu, 15 Jan 2015 16:39:18 GMT Received: from alvin.alvh.no-ip.org (client-186-37-102-215.imovil.entelpcs.cl [186.37.102.215] (may be forged)) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2/) with ESMTP id t0FGdE4d088056; Thu, 15 Jan 2015 16:39:16 GMT Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id E68F2CF9; Thu, 15 Jan 2015 13:02:37 -0300 (CLST) Date: Thu, 15 Jan 2015 13:02:37 -0300 From: Alvaro Herrera To: Heikki Linnakangas Cc: "Faith, Jeremy" , "pgsql-odbc@postgresql.org" Subject: Re: SQL_CURSOR_TYPE prepare execute issue Message-ID: <20150115160237.GQ1663@alvh.no-ip.org> References: <55BAADA01D8C504993894EAEA7517CF80D07AD@003FCH1MPN2-002.003f.mgd2.msft.net> <54B5A38B.4030306@vmware.com> <55BAADA01D8C504993894EAEA7517CF80D08BD@003FCH1MPN2-002.003f.mgd2.msft.net> <54B79C0A.8010703@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <54B79C0A.8010703@vmware.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Server-Quench: 0c4e24f7-9cd5-11e4-b396-002590a15da7 X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCdxZQATClZcSBoa BzkeAQdJTRslYBtL RB4bawxAL0wMSABN M15eIxoIcUtFGBZ7 UjgUWVRVVU1wX2l2 YgBQaktcakxQXAJ0 UUhLXFBTERptCRse BlBaUm8FI3BCLH54 bUZnWD5dXUZ8O0Yu RhtWETsBeG4zPGUC UUENcx4GcwpMYx9F aFV2VCIMZDFWYTQC El17DBcdFx5qYB9s ZjYmEGgpZnw8Ig8E algaBzg3FFcIDygj Ihc7NlNUHV0KL0ha X-Authentic-SMTP: 61633235383639.1023:706 X-AuthFastPath: 0 (Was 255) X-AuthSMTP-Origin: 186.37.102.215/587 X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system. X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org Heikki Linnakangas wrote: > >I have had a quick look over the change and it looks ok to me. Something of a clean up and simplification as well. > >If I understand it correctly, the only things that don't get quoted are SQL_INTEGER and SQL_SMALLINT that pass the new valid_int_literal() test. > >The only thing I can see that could pass that test and not be a valid integer would be a single minus char i.e. "-" > >not sure if there is anyway that could be vulnerable though. > > Ah, good catch. That is definitely a problem. Consider: > > SELECT * FROM foo WHERE 1-? > 0 > > If you replace ? with -, it becomes "--", which comments out the rest of the > query. That's actually a problem with any negative number. > > It would be tempting to just always quote the value, but that again would > lead to subtle changes in the datatype that the server chooses. Maybe you can "quote" it with whitespace, so that it becomes SELECT * FROM foo WHERE 1- -1 > 0 which is no longer a comment and has no other side effect. -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc