pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Bug in ResolveOneParam()
2+ messages / 2 participants
[nested] [flat]

* Bug in ResolveOneParam()
@ 2007-07-16 10:09  Rainer Bauer <usenet@munnin.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Rainer Bauer @ 2007-07-16 10:09 UTC (permalink / raw)
  To: pgsql-odbc

Hello,

I finally was able to track down the bug that occasionally happened when
UseServerSidePrepare was enabled: the driver is writing past allocated memory.

The bug is in ResolveOneParam(). At one point this function writes directly
into the allocated buffer <qb->query_statement> _without_ checking the
allocated size by calling enlarge_query_statement().

I have added the ENLARGE_NEWSTATEMENT() call which should take care of this
bug (see attached patch).

Rainer

inline patch 1: convert.c (+1/-0 lines) download inline-1.patchIndex: convert.c =================================================================== RCS file: /cvsroot/psqlodbc/psqlodbc/convert.c,v retrieving revision 1.161 diff -u -r1.161 convert.c --- convert.c 4 Jun 2007 10:24:49 -0000 1.161 +++ convert.c 16 Jul 2007 09:52:51 -0000 @@ -3459,6 +3472,7 @@ } */ if (req_bind) { + ENLARGE_NEWSTATEMENT( qb, (qb->npos+4) ); npos = qb->npos; qb->npos += 4; }
^ permalink raw reply [nested|flat] 2+ messages in thread

* Re: Bug in ResolveOneParam()
@ 2007-07-17 21:34  Hiroshi Inoue <inoue@tpf.co.jp>
  parent: Rainer Bauer <usenet@munnin.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Hiroshi Inoue @ 2007-07-17 21:34 UTC (permalink / raw)
  To: Rainer Bauer <usenet@munnin.com>; +Cc: pgsql-odbc

Rainer Bauer wrote:
> Hello,
> 
> I finally was able to track down the bug that occasionally happened when
> UseServerSidePrepare was enabled: the driver is writing past allocated memory.

> The bug is in ResolveOneParam(). At one point this function writes directly
> into the allocated buffer <qb->query_statement> _without_ checking the
> allocated size by calling enlarge_query_statement().
> 
> I have added the ENLARGE_NEWSTATEMENT() call which should take care of this
> bug (see attached patch).


Sorry for the delay.
I would take care of it.

Thanks.

Hiroshi Inoue

> Rainer
> 
> Index: convert.c
> ===================================================================
> RCS file: /cvsroot/psqlodbc/psqlodbc/convert.c,v
> retrieving revision 1.161
> diff -u -r1.161 convert.c
> --- convert.c	4 Jun 2007 10:24:49 -0000	1.161
> +++ convert.c	16 Jul 2007 09:52:51 -0000
> @@ -3459,6 +3472,7 @@
>  	} */
>  	if (req_bind)
>  	{
> +		ENLARGE_NEWSTATEMENT( qb, (qb->npos+4) );
>  		npos = qb->npos;
>  		qb->npos += 4;
>  	}




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2007-07-17 21:34 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-07-16 10:09 Bug in ResolveOneParam() Rainer Bauer <usenet@munnin.com>
2007-07-17 21:34 ` Hiroshi Inoue <inoue@tpf.co.jp>

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