PGSQL ODBC driver crash in CC_get_current_schema

Поиск
Список
Период
Сортировка
От Frank van der Aa - Vanboxtel BV
Тема PGSQL ODBC driver crash in CC_get_current_schema
Дата
Msg-id 5524EBEE.2090603@vanboxtel.nl
обсуждение исходный текст
Ответы Re: PGSQL ODBC driver crash in CC_get_current_schema  (Heikki Linnakangas <hlinnaka@iki.fi>)
Список pgsql-odbc
Hi,

we are using the PostgreSQL 9.2.4 with ODBC driver 09.03.0400.

We experience a driver crash when, for some reason (e.g. insufficient permissions), there is no schema set.

This happens because the strdup in the CC_get_current_schema function in connection.c is executed while the 'select current_schema()' query returned NULL.

We have created a patch to workaround the strdup when the result of QR_get_value_backend_text is NULL:

# diff connection.c.orig connection.c
4073c4073,4081
<                               conn->current_schema = strdup(QR_get_value_backend_text(res, 0, 0));
---
>                       {
>                               const char* value = QR_get_value_backend_text(res, 0, 0);
>
>                               if (value == NULL)
>                                       conn->current_schema = NULL;
>                               else
>                                       conn->current_schema = strdup(value);
>
>                       }

We have tested this patch in our environment and didn't experience any problems. However, we don't oversee the entire code, but expect this not to give any more problems.

Would you be able to include this patch in the next release of the ODBC driver? Feel free to contact in case of any questions.

--
Met vriendelijke groeten / Kind regards,

Frank van der Aa

Vanboxtel BV

T+31 (0) 492 327 333
F+31 (0) 492 324 326
Efvdaa@vanboxtel.nl
Iwww.vanboxtel.nl

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

Предыдущее
От: "Pasupunooti, Kiran Kumar (GE, Appl & Light, consultant)"
Дата:
Сообщение: Re: PostgreSQL drivers support for Accessing HAWQ Data.
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: PGSQL ODBC driver crash in CC_get_current_schema