From f365db4e64d4bfcab561936787759348bcd50a7a Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 18 Jan 2017 09:03:23 +0000 Subject: ofz#419 same problem as wmf and emf this is the *third* effective copy of this, see the other two uses of LF_FACESIZE in wmf parsing Change-Id: I475b18314784ad072fe58730c361fc5ca6e65819 Reviewed-on: https://gerrit.libreoffice.org/33256 Tested-by: Jenkins Reviewed-by: Michael Stahl --- vcl/source/gdi/svmconverter.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'vcl/source') diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx index cab6c05ea0db..7bafa7e8f0be 100644 --- a/vcl/source/gdi/svmconverter.cxx +++ b/vcl/source/gdi/svmconverter.cxx @@ -464,6 +464,8 @@ SVMConverter::SVMConverter( SvStream& rStm, GDIMetaFile& rMtf, sal_uLong nConver } } +#define LF_FACESIZE 32 + void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) { const sal_uLong nPos = rIStm.Tell(); @@ -823,7 +825,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) case GDI_FONT_ACTION: { vcl::Font aFont; - char aName[ 32 ]; + char aName[LF_FACESIZE+1]; sal_Int32 nWidth, nHeight; sal_Int16 nCharSet, nFamily, nPitch, nAlign, nWeight, nUnderline, nStrikeout; sal_Int16 nCharOrient, nLineOrient; @@ -831,7 +833,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) ImplReadColor( rIStm, aActionColor ); aFont.SetColor( aActionColor ); ImplReadColor( rIStm, aActionColor ); aFont.SetFillColor( aActionColor ); - rIStm.ReadBytes( aName, 32 ); + size_t nRet = rIStm.ReadBytes(aName, LF_FACESIZE); + aName[nRet] = 0; aFont.SetFamilyName( OUString( aName, strlen(aName), rIStm.GetStreamCharSet() ) ); rIStm.ReadInt32( nWidth ).ReadInt32( nHeight ); rIStm.ReadInt16( nCharOrient ).ReadInt16( nLineOrient ); -- cgit