summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-12-28 20:16:17 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-01-04 20:49:27 +0000
commitba4b5741db25ff3b76a8d10d8f3745dfc1973749 (patch)
tree85969f7e26a6c7ea88dc0755b8e4b2c7b50df8d0
parentTranslated German comments (diff)
downloadcore-ba4b5741db25ff3b76a8d10d8f3745dfc1973749.tar.gz
core-ba4b5741db25ff3b76a8d10d8f3745dfc1973749.zip
check size before looking into the string
Found by Asan. e.g moz233272-2.xpm Change-Id: Ic563db41dbd4ce7250492e99f3e48a203cfdcf00 Reviewed-on: https://gerrit.libreoffice.org/13686 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/source/filter/ixpm/xpmread.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/vcl/source/filter/ixpm/xpmread.cxx b/vcl/source/filter/ixpm/xpmread.cxx
index 3b4b562e3eb9..81c13f210f74 100644
--- a/vcl/source/filter/ixpm/xpmread.cxx
+++ b/vcl/source/filter/ixpm/xpmread.cxx
@@ -22,6 +22,7 @@
#include "rgbtable.hxx"
#define _XPMPRIVATE
#include "xpmread.hxx"
+#include <cstring>
XPMReader::XPMReader(SvStream& rStm)
: mrIStm(rStm)
@@ -342,7 +343,8 @@ bool XPMReader::ImplGetColSub( sal_uInt8* pDest )
{
if ( pRGBTable[ i ].name == NULL )
break;
- if ( pRGBTable[ i ].name[ mnParaSize ] == 0 )
+ if ( std::strlen(pRGBTable[i].name) > mnParaSize &&
+ pRGBTable[ i ].name[ mnParaSize ] == 0 )
{
if ( ImplCompare ( (unsigned char*)pRGBTable[ i ].name,
mpPara, mnParaSize, XPMCASENONSENSITIVE ) )