basic/source/runtime/methods.cxx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
New commits: commit e3e7dfa01119b5f5ab7abc3c6e26049de5d3cc45 Author: Norbert Thiebaud <nthieb...@gmail.com> Date: Sun Nov 18 02:49:27 2012 -0600 basic: fix OUString copy overrun in Mid() Change-Id: I91cdd3a52917b89ab2a452e0eeb7a9e00dc35e8b Reported-by: vmik...@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 ); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits