summaryrefslogtreecommitdiff
path: root/storage/connect/odbconn.cpp
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2015-08-14 14:23:14 +0200
committerOlivier Bertrand <bertrandop@gmail.com>2015-08-14 14:23:14 +0200
commit6d46c977a71a526ee7307b4bd6393ea122e21989 (patch)
tree2d8ac5442921476b343e8142d5ec534739db0167 /storage/connect/odbconn.cpp
parent335ec7a363ffc49c5c974d45782220bf4977d846 (diff)
downloadmariadb-git-6d46c977a71a526ee7307b4bd6393ea122e21989.tar.gz
Fix crash when SetValue_char is called with a negative length value.
This can happen in odbconn.cpp when SQLFetch returns SQL_NO_TOTAL (-4) as length. modified: storage/connect/odbconn.cpp modified: storage/connect/value.cpp
Diffstat (limited to 'storage/connect/odbconn.cpp')
-rw-r--r--storage/connect/odbconn.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp
index 6aaa048de81..1ccdf231970 100644
--- a/storage/connect/odbconn.cpp
+++ b/storage/connect/odbconn.cpp
@@ -2360,9 +2360,11 @@ int ODBConn::GetCatInfo(CATPARM *cap)
} // endif rc
for (n = 0, crp = qrp->Colresp; crp; n++, crp = crp->Next) {
- if (vlen[n] == SQL_NULL_DATA)
+ if (vlen[n] == SQL_NO_TOTAL)
+ ThrowDBX("Unexpected SQL_NO_TOTAL returned from SQLFetch");
+ else if (vlen[n] == SQL_NULL_DATA)
pval[n]->SetNull(true);
- else if (crp->Type == TYPE_STRING && vlen[n] != SQL_NULL_DATA)
+ else if (crp->Type == TYPE_STRING/* && vlen[n] != SQL_NULL_DATA*/)
pval[n]->SetValue_char(pbuf[n], vlen[n]);
else
pval[n]->SetNull(false);