Buffer overflow in extract_diag_error_w()

Andrew Punch <[email protected]> Wed, 11 Nov 2015 17:32:03 +1100
Newsgroups gmane.comp.db.unixodbc.devel
Message-ID <[email protected]>
Hi,

I am working with Netezza in Perl. The script was crashing with a 
segfault. When I used gdb to investigate the problem was isolated to the 
wide_strcpy() call in extract_diag_error_w() due to a larger than 
expected error message from the Netezza driver. The error message from 
the Netezza driver was not corrupt and was in the correct format.

I solved this problem in the short term by increasing 
SQL_MAX_MESSAGE_LENGTH from 512 to 1024. Ideally something like 
wcscpy_s() should be used.

Thanks
-Andrew

diff -ur unixODBC-2.3.1/include/sql.h unixodbc-2.3.1-patched/include/sql.h
--- unixODBC-2.3.1/include/sql.h    2011-07-04 18:54:09.000000000 +1000
+++ unixodbc-2.3.1-patched/include/sql.h    2015-11-11 
16:13:26.709201111 +1100
@@ -46,7 +46,7 @@
  #define SQL_NTSL                  (-3L)

  /* maximum message length */
-#define SQL_MAX_MESSAGE_LENGTH   512
+#define SQL_MAX_MESSAGE_LENGTH   1024

  /* date/time length constants */
  #if (ODBCVER >= 0x0300)
_______________________________________________
unixODBC-dev mailing list
[email protected]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-dev