Re: Bug in convert.c copy_and_convert_field

Поиск
Список
Период
Сортировка
От Paul Cochrane
Тема Re: Bug in convert.c copy_and_convert_field
Дата
Msg-id 420CF423.1090403@tuht.scot.nhs.uk
обсуждение исходный текст
Ответ на Bug in convert.c copy_and_convert_field  (Paul Cochrane <paul.m.cochrane@tuht.scot.nhs.uk>)
Список pgsql-odbc
Paul Cochrane wrote:

> Hi again list.
>
> I think I've encountered a bug in the file convert.c -
> copy_and_convert_field procedure. Unfortunately my C is a little out
> of practise not having done it for 10 years or so. Can anyone help? I
> think I've traced the error to the default part of the switch around
> line 850 (that where the dodgy lines are being placed in the mylog
> file so it's somewhere before that). Below is a snippet of the mylog
> showing the problem. The lines where it is saying DEFAULT: & the ptr
> part of the string. In some cases this is correct but in others there
> are lots of extra / strange characters. The len field always seems to
> be correct however.
>
> The log file ends with a single ' which may explain the error I get on
> the server (1) could not receive data from client: Connection reset by
> peer and (2) unexpected EOF on client connection
>
I've found a quick fix to this problem. I've simply added a line:

                strncpy(ptr+len, "\0", 1);

just before the mylog line on line 850 of convert.c. I believe this
simply ensures that there is a NULL at the end of the string stored in
ptr. There may be a more elegant way to do this but it seems to work.

Now onto the next fault cause it fails again shortly after this.
Bugger!  :-(

Paul

--
  Paul Cochrane       (paul.m.cochrane@tuht.scot.nhs.uk)
+--------------------------------------------------------
| Tayside Orthopaedic & Rehabilitation Technology Centre
| Ninewells Hospital & Medical School
| Dundee, Scotland, UK.
| DD1 9SY
| Phone: Internal: 36284
|        External: +44 (1382) 496284
| Fax:   +44 (1382) 496322
+--------------------------------------------------------


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

Предыдущее
От: Paul Cochrane
Дата:
Сообщение: Bug in convert.c copy_and_convert_field
Следующее
От: "Dave Page"
Дата:
Сообщение: Re: Bug in convert.c copy_and_convert_field