diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2015-07-21 14:02:59 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2015-08-03 17:51:40 +0200 |
commit | 497f3a7b22a08c1b6a05070829e2c0dead52a62e (patch) | |
tree | 5ee002d76db7212db7f561191c2d5c4fb4f13b3a /vcl | |
parent | a9354ec39705da856ed46b3837bbff8a34317fe3 (diff) |
avoid 1-past-the-end string access
Change-Id: Ia475ce737c430fab8d019e1b8a762f81897e0847
Reviewed-on: https://gerrit.libreoffice.org/17261
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/control/field2.cxx | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index 326b94673b5f..dd4a56961051 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; |