pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: lothar.behrens@lollisoft.de
To: pgsql-odbc@postgresql.org
Subject: Buffer overrun in copy_statement_with_parameters ?
Date: Sun, 30 Oct 2005 19:28:38 +0100
Message-ID: <43651EE6.27992.253829E@localhost> (raw)

Hi,

currently I try to find malloc bugs in my code and it may be that some of the
mpatrol log entries are related to the following function in convert.c:

copy_statement_with_parameters(...)

Mpatrol reports 

ERROR: [RNGOVF]: memcpy: range [0x08070370,0x0807038A] overflows 
[0x08070350,0x0
807037E]
    0x08070350 (47 bytes) {malloc:5667:0} [-|-|-]
        0x4058DC9E ???                                  <------- Used as breakpoint
        0x4058BFD2 ???
        0x405A168C ???
        0x4051B60B ???
        0x4048B3FC ???
        0x08049578 main+1452
        0x401D1500 __libc_start_main+224
        0x08048F31 _start+33

But if I print out some debug messages, it seems ok. The buffer is about 4096
bytes. 

Any ideas ?

I have SuSE 9.1/mpatrol 1.4.8/psqlODBC 07.03.0200

Thanks, Lothar

// ...
			if (0 != (qb->flags & FLGB_KEYSET_DRIVEN))
			{
				qb->npos = npos;
				/* ----------
				 * 1st query is for field information
				 * 2nd query is keyset gathering
				 */
				CVT_APPEND_STR(qb, " where ctid = '(0,0)';select 
ctid, oid from ");
				//- Problematic code -----------------------
				CVT_APPEND_DATA(qb, qp->statement + qp-
>from_pos + 5, npos - qp->from_pos - 5);
				//-------------------------------------------------
			}
		}
		stmt->load_statement = malloc(npos + 1);
		memcpy(stmt->load_statement, qb->query_statement, npos);
		stmt->load_statement[npos] = '\0';
	}
#endif   /* DRIVER_CURSOR_IMPLEMENT */

-- 
Lothar Behrens	|	Rapid Prototyping ...
Rosmarinstr 3		|	
40235 Düsseldorf  	|	www.lollisoft.de






Message-ID: <43651EE6.27992.253829E@localhost>
Permalink:  ../43651EE6.27992.253829E@localhost/
Also on:    postgresql.org/message-id/43651EE6.27992.253829E@localhost

 · 

reply

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: lothar.behrens@lollisoft.de
  Subject: Re: Buffer overrun in copy_statement_with_parameters ?
  In-Reply-To: <43651EE6.27992.253829E@localhost>
  References: <43651EE6.27992.253829E@localhost>

* 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