Bug #6156 Fetching empty string returns a string which isn't NULL terminated
Submitted: 19 Oct 2004 10:56 Modified: 3 Nov 2004 13:56
Reporter: Michael Ziehensack Email Updates:
Status: Closed Impact on me:
None 
Category:MaxDB Severity:S2 (Serious)
Version:7.5.00.18 OS:Windows (Windows 2000)
Assigned to: Ulf Wendel CPU Architecture:Any

[19 Oct 2004 10:56] Michael Ziehensack
Description:
ODBC-Problem with sqlod32w.dll:

Fetching an empty string from a table of type "LONG UNICODE" into a SQL_C_WCHAR buffer returns a value which is not NULL-terminated.

How to repeat:
- MaxDB 7.5.00.18 installation on Windows 2000 SP, 4 32-Bit
- Unicode-enabled database (i.e., _UNICODE = YES)
- Database default code set to unicode (i.e., DEFAULT_CODE = UNICODE)
- Table with column of type "LONG UNICODE" (i.e.,
  "CREATE TABLE test (val LONG UNICODE)"
- (Local) ODBC-datasource with sqlod32w.dll "MaxDB (Unicode)" ODBC-driver,
   version 7.5.00.18

See attached sample code in "EmptyUnicodeStrValErrApp.cpp". 

Fetching the empty string into the SQL_C_WCHAR buffer returns a string which isn't NULL-terminated (seems to me that bound output buffer isn't touched at all..", when using the "MaxDB (Unicode)"-ODBC driver of version 7.5.00.18.
For any string that has a length > 0 everything seems to work fine and string
fetched into bound output buffer is correctly NULL terminated. Problem also doesn't occur with empty strings from a column of type "VARCHAR (n) UNICODE" which are fetched the same way...
[19 Oct 2004 10:58] Michael Ziehensack
Sample application to demonstrate the bug

Attachment: EmptyUnicodeStringErrorApp.cpp (application/octet-stream, text), 3.98 KiB.

[19 Oct 2004 11:02] Michael Ziehensack
changed synopsis
[28 Oct 2004 15:04] Ulf Wendel
Thanks again for your input!

I could verify this bug. Our development team is looking for a solution.

Best regards,
Ulf Wendel
[3 Nov 2004 13:56] Ulf Wendel
The bug has been located. It is already fixed in the sources. It will be released with Build 21 - 7.5.00.21.

Best Regards,
Ulf Wendel