summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2015-07-21 14:02:59 +0200
committerLionel Elie Mamane <lionel@mamane.lu>2015-07-21 14:28:46 +0200
commit0aff4109b5fd2f6c3893b14cc61c8962e2b47ea9 (patch)
tree499439da67f07806107fad1efa7a702c951d44c3 /vcl
parent3e926736c7a1ec0a622ff446466113d9ccd8cb11 (diff)
avoid 1-past-the-end string access
Change-Id: Ia475ce737c430fab8d019e1b8a762f81897e0847
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/control/field2.cxx9
1 files changed, 4 insertions, 5 deletions
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index 7efb8e69665c..d35a4e769067 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -432,15 +432,14 @@ static sal_Int32 ImplPatternRightPos( const OUString& rStr, const OString& rEdit
{
// search non-literal successor
sal_Int32 nNewPos = nCursorPos;
- sal_Int32 nTempPos = nNewPos;
- while ( nTempPos < rEditMask.getLength() )
+ ;
+ for(sal_Int32 nTempPos = nNewPos+1; nTempPos < rEditMask.getLength(); ++nTempPos )
{
- if ( rEditMask[nTempPos+1] != EDITMASK_LITERAL )
+ if ( rEditMask[nTempPos] != EDITMASK_LITERAL )
{
- nNewPos = nTempPos+1;
+ nNewPos = nTempPos;
break;
}
- nTempPos++;
}
ImplPatternMaxPos( rStr, rEditMask, nFormatFlags, bSameMask, nCursorPos, nNewPos );
return nNewPos;