From 2bc0a808392cff87342bf9377c4066169c7150e7 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 2 Jun 2015 16:56:08 +0200 Subject: -fsanitize=nonnull-attribute in memcpy call Change-Id: I4fc491906311781b9941c8f02d99d254542027ae --- rsc/source/tools/rsctools.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'rsc') diff --git a/rsc/source/tools/rsctools.cxx b/rsc/source/tools/rsctools.cxx index 5a486e0eecbf..83526835b7f6 100644 --- a/rsc/source/tools/rsctools.cxx +++ b/rsc/source/tools/rsctools.cxx @@ -305,7 +305,11 @@ void RscWriteRc :: PutUTF8( char * pStr ) n++; sal_uInt32 nOldLen = IncSize( n ); - memcpy( GetPointer( nOldLen ), pStr, nStrLen ); + char * p = GetPointer( nOldLen ); + if (nStrLen != 0) + { + memcpy( p, pStr, nStrLen ); + } // 0 terminated pMem[ nOldLen + nStrLen ] = '\0'; } -- cgit