diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-02-23 12:10:08 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-02-23 12:10:08 +0100 |
commit | 280cd27dbdab438e63ecb2599ab5dd20e04d71d5 (patch) | |
tree | 0a26f23443a70896c1667f71f4ae4bada7700b98 /sal | |
parent | ee619fb344c7e8f491e09bd256df7f8567af9bef (diff) |
-Werror=format-truncation
Change-Id: I1b27289724389018bd4048573e8c8e4cf28eb983
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/unx/file_volume.cxx | 9 |
1 files changed, 7 insertions, 2 deletions
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 <sal/config.h> + +#include <cassert> + #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<oslVolumeDeviceHandleImpl*>(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); |