[Libreoffice-commits] .: basic/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sun Nov 18 00:50:44 PST 2012
basic/source/runtime/methods.cxx | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
New commits:
commit e3e7dfa01119b5f5ab7abc3c6e26049de5d3cc45
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date: Sun Nov 18 02:49:27 2012 -0600
basic: fix OUString copy overrun in Mid()
Change-Id: I91cdd3a52917b89ab2a452e0eeb7a9e00dc35e8b
Reported-by: vmiklos at suse.cz
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 08d6699..18da6ae 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -1267,7 +1267,18 @@ RTLFUNC(Mid)
else
{
OUString aResultStr;
- aResultStr = aArgStr.copy( nStartPos, nLen );
+ if(nLen < 0)
+ {
+ aResultStr = aArgStr.copy( nStartPos);
+ }
+ else
+ {
+ if(nStartPos + nLen > aArgStr.getLength())
+ {
+ nLen = aArgStr.getLength() - nStartPos;
+ }
+ aResultStr = aArgStr.copy( nStartPos, nLen );
+ }
rPar.Get(0)->PutString( aResultStr );
}
}
More information about the Libreoffice-commits
mailing list