Skip site navigation (1) Skip section navigation (2)

Re: crash in LIBPQ_execute_query

From: "Dave Page" <dpage(at)vale-housing(dot)co(dot)uk>
To: "Scot Loach" <sloach(at)sandvine(dot)com>, <pgsql-odbc(at)postgresql(dot)org>
Cc: "Anoop Kumar" <anoopk(at)pervasive-postgres(dot)com>
Subject: Re: crash in LIBPQ_execute_query
Date: 2005-09-02 12:57:30
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-odbc

> -----Original Message-----
> From: pgsql-odbc-owner(at)postgresql(dot)org 
> [mailto:pgsql-odbc-owner(at)postgresql(dot)org] On Behalf Of Scot Loach
> Sent: 02 September 2005 13:12
> To: pgsql-odbc(at)postgresql(dot)org
> Subject: [ODBC] crash in LIBPQ_execute_query
> Some of the queries we use can be very large.
> My code is crashing here:
> QResultClass *
> LIBPQ_execute_query(ConnectionClass *self,char *query)        
>                   {       
>         QResultClass *qres;                                   
>                           PGresult *pgres;
>         char            *ptr;
>         char            cmdbuffer[ERROR_MSG_LENGTH + 1];
>     char                errbuffer[ERROR_MSG_LENGTH + 1];      
>                       int         pos=0;
>         strcpy(cmdbuffer,query);
> ERROR_MSG_LENGTH is 4096, my query is larger than that.
> What's the rationale here and how do we fix it?  This works 
> 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

Attachment: libpq_execute.patch
Description: application/octet-stream (3.3 KB)

pgsql-odbc by date

Next:From: Joel FradkinDate: 2005-09-02 14:08:18
Subject: Re: figuring out why I am having this issue
Previous:From: Merlin MoncureDate: 2005-09-02 12:45:36
Subject: Re: crash in LIBPQ_execute_query

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group