odbc bug in convert.c

Поиск
Список
Период
Сортировка
От Thomas Zehbe
Тема odbc bug in convert.c
Дата
Msg-id 200407161250.51614.tz@ingenion.de
обсуждение исходный текст
Ответы Re: odbc bug in convert.c  (Peter Eisentraut <peter_e@gmx.net>)
Re: odbc bug in convert.c  (Peter Eisentraut <peter_e@gmx.net>)
Список 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

Вложения

В списке pgsql-odbc по дате отправления:

Предыдущее
От: surfunbear@yahoo.com (Larry)
Дата:
Сообщение: ODBC questions
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: odbc bug in convert.c