[Libreoffice-commits] core.git: sal/osl

Stephan Bergmann sbergman at redhat.com
Tue Jan 23 20:52:34 UTC 2018


 sal/osl/unx/security.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit a886fbfb54b1b770e57862a4ce58f99dbdb368fa
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jan 23 11:18:00 2018 +0100

    Silence upcoming GCC 8 -Werror=sizeof-pointer-memaccess
    
    ...("error: argument to ‘sizeof’ in ‘char* strncpy(char*, const char*, size_t)’
    call is the same expression as the source; did you mean to use the size of the
    destination?") in a place where the use of strncpy instead of strcpy (introduced
    with 9276f7d5740a28b342db2a9bcd8644ff2f4f5742 "fdo#32263") doesn't help prevent
    any buffer overflows anyway (the target's size already having been checked to be
    sufficiently large).
    
    Change-Id: I70773538f4092f1306fb00f1fa7f9138e06894e5
    Reviewed-on: https://gerrit.libreoffice.org/48391
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sal/osl/unx/security.cxx b/sal/osl/unx/security.cxx
index 9b76060f40a2..49a0320bc023 100644
--- a/sal/osl/unx/security.cxx
+++ b/sal/osl/unx/security.cxx
@@ -365,7 +365,7 @@ static bool osl_psz_getConfigDir(oslSecurity Security, sal_Char* pszDirectory, s
         n = strlen(pszDirectory);
         if (n + sizeof(DOT_CONFIG) < nMax)
         {
-            strncpy(pszDirectory+n, DOT_CONFIG, sizeof(DOT_CONFIG));
+            strcpy(pszDirectory+n, DOT_CONFIG); // safe
 
             // try to create dir if not present
             bool dirOK = true;


More information about the Libreoffice-commits mailing list