summaryrefslogtreecommitdiff
path: root/sc/source/core/tool/token.cxx
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-11-16 17:07:58 +0100
committerEike Rathke <erack@redhat.com>2017-11-16 17:09:20 +0100
commit280a5166ad4032a618c5e29db701330f7dbdfbff (patch)
treea638113b586ac74df0915a38567d06e8b4b6dd2f /sc/source/core/tool/token.cxx
parent4ff66e42bfd7d03020d9fd09bc24aef92d92ecd0 (diff)
Straighten use of MAXSTRLEN to be maximum string length
... plus limiting 0-character, and not buffer length in (only) some cases where max len then was MAXSTRLEN-1, accompanied by a mix of >= and > comparisons. Change-Id: I5b8452db52b1d464eb1410e31990043f7997af20
Diffstat (limited to 'sc/source/core/tool/token.cxx')
-rw-r--r--sc/source/core/tool/token.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 865f384ddaf2..696bbe8705cb 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -354,8 +354,8 @@ void ScRawToken::SetExternal( const sal_Unicode* pStr )
eOp = ocExternal;
eType = svExternal;
sal_Int32 nLen = GetStrLen( pStr ) + 1;
- if( nLen >= MAXSTRLEN )
- nLen = MAXSTRLEN-1;
+ if( nLen > MAXSTRLEN )
+ nLen = MAXSTRLEN;
// Leave space for byte parameter!
memcpy( cStr+1, pStr, nLen * sizeof(sal_Unicode) );
cStr[ nLen+1 ] = 0;