Re: [BUGS] There is a case in which psqlodbc-09.03.0400 returns unterminated strings on Windows.

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Naoya Anzai <nao-anzai(at)xc(dot)jp(dot)nec(dot)com>, "pgsql-odbc(at)postgresql(dot)org" <pgsql-odbc(at)postgresql(dot)org>
Cc: Akio Iwaasa <aki-iwaasa(at)vt(dot)jp(dot)nec(dot)com>
Subject: Re: [BUGS] There is a case in which psqlodbc-09.03.0400 returns unterminated strings on Windows.
Date: 2015-09-22 07:55:02
Message-ID: 56010956.1060108@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

On 09/16/2015 05:20 AM, Naoya Anzai wrote:
> Hi,
>
> I found a bug which psqlODBC returns a string without null-terminated when SQLFetch is executed on Windows.
> IMHO, it seems to be caused by differences of snprintf function between Windows and Linux.
> You have changed sprintf into snprintf at psqlodbc-09.03.0400 release.
> But snprintf on Windows(_snprintf) doesn't include a terminating character(\0) when a copy buffer length is less than an original buffer length; besides this returns -1.
> Their behavior are different from that of Linux but psqlODBC does not currently make allowances for their differences.
>
> As you can confirm this bug, I attached a program(test.cpp) which reproduces a bug.

Yep. This was already fixed in git master in January, in commit
532c0dad20087201feee3851652c114eb820311f.

We're long overdue for a release...

- Heikki

In response to

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Andrus 2015-09-22 08:03:34 Re: How to fix buffer overrun in Windows x32
Previous Message Heikki Linnakangas 2015-09-22 07:31:36 Re: How to fix buffer overrun in Windows x32