odbc bug in convert.c

From: Thomas Zehbe <tz(at)ingenion(dot)de>
To: pgsql-odbc(at)postgresql(dot)org
Subject: odbc bug in convert.c
Date: 2004-07-16 10:50:51
Message-ID: 200407161250.51614.tz@ingenion.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Hello!
I just debugged convert.c because it crashed with a segmentation violation.
The driver version I use is "psqlodbc-07.03.0200" wich i compiled from scratch
with the only option "--with-iodbc". The config.log from ./configure is
attached.
My client system is a SUSE 9.0 LINUX distribution with a "2.4.21-99-athlon"
kernel connected to a PostgreSQL 7.3.4 Server.
This is the code (starting at line 1041, with HAVE_LOCAL_H defined) which
crashed:
<snip>
case SQL_C_FLOAT:
#ifdef HAVE_LOCALE_H
strcpy(saved_locale, setlocale(LC_ALL, NULL));
setlocale(LC_ALL, "C");
#endif /* HAVE_LOCALE_H */
len = 4;
if (bind_size > 0)
*((SFLOAT *) rgbValueBindRow) = (float) atof(neut_str);
else
*((SFLOAT *) rgbValue + bind_row) = (float) atof(neut_str);
#ifdef HAVE_LOCALE_H
setlocale(LC_ALL, saved_locale);
#endif /* HAVE_LOCALE_H */
break;
</snip>
The "strcpy(saved_locale, setlocale(LC_ALL, NULL));" wites 326 bytes to the
"saved_locale" target, wich is only 256 bytes long (defined at line 387).
This results in overwriting the contents of "bind_size", "rgbValueBindRow"
and "rgbValue" which leads to the sigseg.
Defining
char saved_locale[1024];
solved the problem.
BTW Many thanks for your work!
Best regards

Thomas Zehbe

INGENION GmbH
Luther Weg 50
31515 Wunstorf

Tel 05031-902042
Fax 05031-902049
www.ingenion.de

Attachment Content-Type Size
config.log text/x-log 21.8 KB

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Jeff Eckermann 2004-07-16 14:44:20 Re: time columns: ms-access bound controls
Previous Message Dave Page 2004-07-16 08:45:16 Re: ODBC Developers