[unixODBC-support] SQLGetDiagFieldW, SQL_DIAG_MESSAGE_TEXT hangs

Nick Gorham nick at lurcher.org
Mon Jul 29 09:09:27 BST 2013

On 27/07/13 18:28, Frank A. U. wrote:
> Hello,
> If I call SQLGetDiagFieldW with SQL_DIAG_MESSAGE_TEXT a second time it
> hangs.  SQLGetDiagFieldA doesn't do that.
> I looked at the source and compared the two functions. I found that
> SQLGetDiagFieldW does not check str before it is freed.
> I attached a patch (untested) for your review.
Can I check what source you are looking at, as 2.3.2pre has that fixed 
from what I can see.

> Also I noticed that SQLGetDiagFieldW returns the number of characters
> via string_length_ptr, which according to the MS spec is wrong, -- it
> should be the number of bytes.  See
> http://support.microsoft.com/kb/294169

Changed that, well spotted. I like the "Regardless of what the 
documentation says for each ODBC function" :-)


More information about the unixODBC-support mailing list