summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2012-10-14 22:51:31 -0500
committerNorbert Thiebaud <nthiebaud@gmail.com>2012-10-15 14:02:01 +0000
commit9048f4e010da9d695a38cb11a16d8ecec63083a4 (patch)
tree1a383cc7667143180c4dcaea71e124cc89c55314 /vcl
parent0c120f9dd429e035c1e4595c702411241c4431ea (diff)
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@redhat.com> Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/fontsubset/cff.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx
index bcb94e509613..93817ff35f68 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);