Closed matthew-wozniczka closed 3 years ago
Noticed this in 3.52.15, it used to work.
in 3.52.8, it did
if (szColName != NULL && cbColNameMax > 0 && ((penv->unicode_driver && waMode != 'W') || (!penv->unicode_driver && waMode == 'W')) ) { if (waMode != 'W') { /* ansi=>unicode*/ if ((_ColName = _iodbcdm_alloc_var(pstmt, 0, cbColNameMax * sizeof(wchar_t))) == NULL) { PUSHSQLERR (pstmt->herr, en_HY001); return SQL_ERROR; } } else { /* unicode=>ansi*/ if ((_ColName = _iodbcdm_alloc_var(pstmt, 0, cbColNameMax)) == NULL) { PUSHSQLERR (pstmt->herr, en_HY001); return SQL_ERROR; } } colNameOut = _ColName; }
Note the szColName != NULL && cbColNameMax > 0 checks.
szColName != NULL && cbColNameMax > 0
in the new code, it just does
if (conv_direct == CD_A2W || conv_direct == CD_W2W) { /*ansi<=unicode*/ if ((_ColName = _iodbcdm_alloc_var(pstmt, 0, cbColNameMax * DRV_WCHARSIZE_ALLOC(conv))) == NULL) { PUSHSQLERR (pstmt->herr, en_HY001); return SQL_ERROR; } colNameOut = _ColName; } else if (conv_direct == CD_W2A) { /*unicode<=ansi*/ if ((_ColName = _iodbcdm_alloc_var(pstmt, 0, cbColNameMax * MB_CUR_MAX + 1)) == NULL) { PUSHSQLERR (pstmt->herr, en_HY001); return SQL_ERROR; } colNameOut = _ColName; }
and _iodbcdm_alloc_var returns NULL if passed a size of 0.
_iodbcdm_alloc_var
Fixed, patch will be in Git soon.
Patch was commited
Patch: https://github.com/openlink/iODBC/commit/80b14419e416cc80d7dddd46e3568effe4c5fc19
Noticed this in 3.52.15, it used to work.
in 3.52.8, it did
Note the
szColName != NULL && cbColNameMax > 0
checks.in the new code, it just does
and
_iodbcdm_alloc_var
returns NULL if passed a size of 0.