[Libreoffice-commits] .: vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Oct 15 07:02:31 PDT 2012


 vcl/source/fontsubset/cff.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 9048f4e010da9d695a38cb11a16d8ecec63083a4
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Sun Oct 14 22:51:31 2012 -0500

    cid 703925 : strncpy can lead to non-null terminated string
    
    Change-Id: Idfe2278d0008715a2e0f06d60df9af430e4df25c
    Reviewed-on: https://gerrit.libreoffice.org/874
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Norbert Thiebaud <nthiebaud at gmail.com>

diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx
index bcb94e5..93817ff 100644
--- a/vcl/source/fontsubset/cff.cxx
+++ b/vcl/source/fontsubset/cff.cxx
@@ -2051,7 +2051,8 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter,
     if( !*pFontName ) {
         if( mnFontNameSID) {
             // get the fontname directly if available
-            strncpy( pFontName, getString( mnFontNameSID), sizeof(rEmitter.maSubsetName));
+            strncpy( pFontName, getString( mnFontNameSID), sizeof(rEmitter.maSubsetName) - 1);
+            pFontName[sizeof(rEmitter.maSubsetName) - 1] = 0;
         } else if( mnFullNameSID) {
             // approximate fontname as fullname-whitespace
             const char* pI = getString( mnFullNameSID);


More information about the Libreoffice-commits mailing list