summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill King <bill.king@nokia.com>2009-05-14 04:15:21 (GMT)
committerBill King <bill.king@nokia.com>2009-05-14 04:19:32 (GMT)
commit4cfe2b57d97488b4f312ad2ec2985f619b4984b6 (patch)
tree04936b64a7292a29d63bb440c3991662cd6c41a6
parent54ad50c99fee0db0dc9a64ee16dfcc4315b9d86d (diff)
downloadQt-4cfe2b57d97488b4f312ad2ec2985f619b4984b6.zip
Qt-4cfe2b57d97488b4f312ad2ec2985f619b4984b6.tar.gz
Qt-4cfe2b57d97488b4f312ad2ec2985f619b4984b6.tar.bz2
Use newer safer error function if available.
Uses fb_interpret instead of isc_interprete if using firebird. Closes a potential security hole/buffer overrun. Reviewed-by: Justin McPherson
-rw-r--r--src/sql/drivers/ibase/qsql_ibase.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp
index 6834d9a..4f3d79d 100644
--- a/src/sql/drivers/ibase/qsql_ibase.cpp
+++ b/src/sql/drivers/ibase/qsql_ibase.cpp
@@ -66,8 +66,11 @@ QT_BEGIN_NAMESPACE
enum { QIBaseChunkSize = SHRT_MAX / 2 };
-static bool getIBaseError(QString& msg, ISC_STATUS* status, ISC_LONG &sqlcode,
- QTextCodec *tc)
+#if defined(FB_API_VER) && FB_API_VER >= 20
+static bool getIBaseError(QString& msg, const ISC_STATUS* status, ISC_LONG &sqlcode, QTextCodec *tc)
+#else
+static bool getIBaseError(QString& msg, ISC_STATUS* status, ISC_LONG &sqlcode, QTextCodec *tc)
+#endif
{
if (status[0] != 1 || status[1] <= 0)
return false;
@@ -75,7 +78,11 @@ static bool getIBaseError(QString& msg, ISC_STATUS* status, ISC_LONG &sqlcode,
msg.clear();
sqlcode = isc_sqlcode(status);
char buf[512];
+#if defined(FB_API_VER) && FB_API_VER >= 20
+ while(fb_interpret(buf, 512, &status)) {
+#else
while(isc_interprete(buf, &status)) {
+#endif
if(!msg.isEmpty())
msg += QLatin1String(" - ");
if (tc)