diff options
author | Julien Chaffraix <julien.chaffraix@gmail.com> | 2011-04-14 22:52:46 -0700 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-04-19 09:48:04 +0100 |
commit | 8af99e57686fb9ea4da1fcf890c7a7ce9e50c83f (patch) | |
tree | ce3e35befcfb073da84cd3e75e8e4ba821ceed00 /tools/source | |
parent | cd31cc2a4a2d0969795789dd3877ee6d04998746 (diff) |
Fixed an off-by-one error in DbgOut.
"..." is actually 4 characters long due to the '\0' character and
strcpy does copy the '\0'. Thus we need to remove 4 from the length
to avoid writing one byte after the end of the buffer.
Diffstat (limited to 'tools/source')
-rw-r--r-- | tools/source/debug/debug.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/source/debug/debug.cxx b/tools/source/debug/debug.cxx index c4df718d90aa..167eafded33d 100644 --- a/tools/source/debug/debug.cxx +++ b/tools/source/debug/debug.cxx @@ -1701,7 +1701,7 @@ void DbgOut( const sal_Char* pMsg, sal_uInt16 nDbgOut, const sal_Char* pFile, sa int nMsgLen = strlen( pMsg ); if ( nBufLen+nMsgLen > DBG_BUF_MAXLEN ) { - int nCopyLen = DBG_BUF_MAXLEN-nBufLen-3; + int nCopyLen = DBG_BUF_MAXLEN-nBufLen-4; strncpy( &(aBufOut[nBufLen]), pMsg, nCopyLen ); strcpy( &(aBufOut[nBufLen+nCopyLen]), "..." ); } |