summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2014-01-30 06:07:56 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-01-30 13:35:14 +0000
commit88eee0c3d591b210257298f3fd094727bd0dc05e (patch)
tree200aa7f9c85403585e6f04ebdd08d32ec17bb622
parent6ba4ad5b475eb54002ab2b820d0b327b3961a17e (diff)
fdo#74160 firebird XParameters::setString truncate to 65535 characters
as opposed to 17 characters Change-Id: I65c82243946c22eee0f033977b1cd0c5a84d226b Reviewed-on: https://gerrit.libreoffice.org/7745 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--connectivity/source/drivers/firebird/PreparedStatement.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index 128f35716f76..739f18a2c737 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -208,10 +208,11 @@ void SAL_CALL OPreparedStatement::setString(sal_Int32 nParameterIndex,
switch (dtype) {
case SQL_VARYING:
{
+ const sal_Int32 max_varchar_len = 0xFFFF;
// First 2 bytes indicate string size
- if (str.getLength() > (2^16)-1)
+ if (str.getLength() > max_varchar_len)
{
- str = str.copy(0, (2^16)-1);
+ str = str.copy(0, max_varchar_len);
}
const short nLength = str.getLength();
memcpy(pVar->sqldata, &nLength, 2);