diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-09-18 13:34:35 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-09-18 15:06:20 +0100 |
commit | 9bb1b4c5a1529a4cca09d0ed3e5325bf9310e814 (patch) | |
tree | d0949f8d7bb786f676c9e3a4fa1d025b28fe307c /editeng/source/misc | |
parent | 8001d9f4fed8f32410128b180d881d1131317255 (diff) |
don't access string out of bounds
Change-Id: I1cee53bc864efaa4ae3b4462111cad4dc80e82be
Diffstat (limited to 'editeng/source/misc')
-rw-r--r-- | editeng/source/misc/svxacorr.cxx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index bb24fe016be8..2e932e786bfe 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -642,11 +642,16 @@ sal_Bool SvxAutoCorrect::FnAddNonBrkSpace( while( nSttWdPos && !(bWasWordDelim = IsWordDelim( rTxt[ --nSttWdPos ]))) ; - if(INetURLObject::CompareProtocolScheme(rTxt.copy(nSttWdPos + (bWasWordDelim ? 1 : 0), nEndPos - nSttWdPos + 1)) != INET_PROT_NOT_VALID) { - return sal_False; + //See if the text is the start of a protocol string, e.g. have text of + //"http" see if it is the start of "http:" and if so leave it alone + sal_Int32 nIndex = nSttWdPos + (bWasWordDelim ? 1 : 0); + sal_Int32 nProtocolLen = nEndPos - nSttWdPos + 1; + if (nIndex + nProtocolLen <= rTxt.getLength()) + { + if (INetURLObject::CompareProtocolScheme(rTxt.copy(nIndex, nProtocolLen)) != INET_PROT_NOT_VALID) + return sal_False; } - // Check the presence of "://" in the word xub_StrLen nStrPos = rTxt.indexOf( "://", nSttWdPos + 1 ); if ( STRING_NOTFOUND == nStrPos && nEndPos > 0 ) |