X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 88A91D7F21 for ; Fri, 2 Sep 2005 11:21:45 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62809-01 for ; Fri, 2 Sep 2005 14:21:41 +0000 (GMT) Received: from mailserver.sandvine.com (sandvine.com [199.243.201.138]) by svr1.postgresql.org (Postfix) with ESMTP id B41E9D7B19 for ; Fri, 2 Sep 2005 11:21:39 -0300 (ADT) X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: Re: crash in LIBPQ_execute_query Date: Fri, 2 Sep 2005 10:21:44 -0400 Message-ID: <71837C040963F748B9B94E123A289678664E02@mailserver.sandvine.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [ODBC] crash in LIBPQ_execute_query Thread-Index: AcWvt4Yy5v0zpJNFRQuOblwLRg0d4gAAysJAAAO7FVA= From: "Scot Loach" To: "Dave Page" , Cc: "Anoop Kumar" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 required=5 tests=[none] X-Spam-Level: X-Archive-Number: 200509/30 X-Sequence-Number: 5928 That seems to work. Thanks for the quick reply Dave. -----Original Message----- From: Dave Page [mailto:dpage@vale-housing.co.uk] Sent: Friday, September 02, 2005 8:58 AM To: Scot Loach; pgsql-odbc@postgresql.org Cc: Anoop Kumar Subject: RE: [ODBC] crash in LIBPQ_execute_query =20 > -----Original Message----- > From: pgsql-odbc-owner@postgresql.org=20 > [mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Scot Loach > Sent: 02 September 2005 13:12 > To: pgsql-odbc@postgresql.org > Subject: [ODBC] crash in LIBPQ_execute_query >=20 > Some of the queries we use can be very large. > My code is crashing here: >=20 > QResultClass * > LIBPQ_execute_query(ConnectionClass *self,char *query) =20 > { =20 > QResultClass *qres; =20 > PGresult *pgres; > char *ptr; > char cmdbuffer[ERROR_MSG_LENGTH + 1]; > char errbuffer[ERROR_MSG_LENGTH + 1]; =20 > int pos=3D0; >=20 > strcpy(cmdbuffer,query); >=20 >=20 > ERROR_MSG_LENGTH is 4096, my query is larger than that. > What's the rationale here and how do we fix it? This works=20 > fine with the old driver. Urgh. To be honest, I can't see any need to copy that string at all in there, so the limit is entirely unwarranted. In addition, there's code in there marked #ifndef USE_LIBPQ (in LIBPQ_Execute!!), and, it sets the rowcount to -1 if it can't find a space in the SQL query! I've tidied that up - patch attached. Please let me know how it goes. Regards, Dave