From 280cd27dbdab438e63ecb2599ab5dd20e04d71d5 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 23 Feb 2017 12:10:08 +0100 Subject: -Werror=format-truncation Change-Id: I1b27289724389018bd4048573e8c8e4cf28eb983 --- sal/osl/unx/file_volume.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'sal/osl') diff --git a/sal/osl/unx/file_volume.cxx b/sal/osl/unx/file_volume.cxx index 0940eab3f9f3..5462368c0308 100644 --- a/sal/osl/unx/file_volume.cxx +++ b/sal/osl/unx/file_volume.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include + +#include + #include "osl/file.h" #include "osl/diagnose.h" @@ -353,7 +357,7 @@ static rtl_uString* oslMakeUStrFromPsz(const sal_Char* pszStr, rtl_uString** ust oslFileError osl_getVolumeDeviceMountPath( oslVolumeDeviceHandle Handle, rtl_uString **pstrPath ) { oslVolumeDeviceHandleImpl* pItem = static_cast(Handle); - sal_Char Buffer[PATH_MAX]; + sal_Char Buffer[RTL_CONSTASCII_LENGTH("file://") + PATH_MAX]; Buffer[0] = '\0'; @@ -367,7 +371,8 @@ oslFileError osl_getVolumeDeviceMountPath( oslVolumeDeviceHandle Handle, rtl_uSt return osl_File_E_INVAL; } - snprintf(Buffer, sizeof(Buffer), "file://%s", pItem->pszMountPoint); + int n = snprintf(Buffer, sizeof(Buffer), "file://%s", pItem->pszMountPoint); + assert(n >= 0 && unsigned(n) < sizeof(Buffer)); (void) n; #ifdef DEBUG_OSL_FILE fprintf(stderr,"Mount Point is: '%s'\n",Buffer); -- cgit