summaryrefslogtreecommitdiffstats
path: root/editeng
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-09-17 14:46:05 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-09-17 14:47:09 +0100
commit98214397cd5fc10cdefd6ba9c36746532942709b (patch)
tree30547c188a9c991af9b22697c9ab7d0333aa5597 /editeng
parentunfold this god-awful mess, logic unchanged (diff)
downloadcore-98214397cd5fc10cdefd6ba9c36746532942709b.tar.gz
core-98214397cd5fc10cdefd6ba9c36746532942709b.zip
don't access string out of bounds
Change-Id: I304b74270f73b9f94568edf2613e2581459cc4f9
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/misc/svxacorr.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index dd2a6ec93309..bb24fe016be8 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -845,8 +845,15 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc,
sal::static_int_cast< xub_StrLen >( pWordStt - pStart ) ) ) )
return sal_False; // already ok
- if (INetURLObject::CompareProtocolScheme(rTxt.copy(pWordStt - pStart, pDelim - pWordStt + 1)) != INET_PROT_NOT_VALID)
- return sal_False; // already ok
+ //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 = pWordStt - pStart;
+ sal_Int32 nProtocolLen = pDelim - pWordStt + 1;
+ if (nIndex + nProtocolLen <= rTxt.getLength())
+ {
+ if (INetURLObject::CompareProtocolScheme(rTxt.copy(nIndex, nProtocolLen)) != INET_PROT_NOT_VALID)
+ return sal_False; // already ok
+ }
if (0x1 == *pWordStt || 0x2 == *pWordStt)
return sal_False; // already ok