summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-02-23 12:10:08 +0100
committerAron Budea <aron.budea@collabora.com>2018-01-17 20:12:36 +0100
commit778c9d539326309abc93652cc06fbe8b28c8a0a1 (patch)
treee550c43782da205a43327b9bc9a2196d26978f14 /sal
parentb4f26014c380ecc3d93875a161747da489db72e4 (diff)
-Werror=format-truncation
Change-Id: I1b27289724389018bd4048573e8c8e4cf28eb983 (cherry picked from commit 280cd27dbdab438e63ecb2599ab5dd20e04d71d5)
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/file_volume.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/sal/osl/unx/file_volume.cxx b/sal/osl/unx/file_volume.cxx
index 28ce4a9762a4..722b18dd564e 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);