[Libreoffice-commits] core.git: Branch 'aoo/trunk' - rsc/source sal/osl

Pedro Giffuni pfg at apache.org
Fri Dec 18 16:08:18 PST 2015


 rsc/source/rscpp/cpp1.c |    3 ++-
 sal/osl/unx/profile.c   |    1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

New commits:
commit dcfb7880a25c4d0f9630046d332ff8340ed83aed
Author: Pedro Giffuni <pfg at apache.org>
Date:   Sat Dec 19 00:00:28 2015 +0000

    Remember to NULL terminate when using strncpy.
    
    All systems should have strlcpy.

diff --git a/rsc/source/rscpp/cpp1.c b/rsc/source/rscpp/cpp1.c
index b1aff3f..de33f0b 100644
--- a/rsc/source/rscpp/cpp1.c
+++ b/rsc/source/rscpp/cpp1.c
@@ -329,7 +329,8 @@ nRunde++;
                     cerror("Can't open input file \"%s\"", useargv[1]);
                     exit(IO_ERROR);
                 }
-                strncpy(work, useargv[1], sizeof(work));  /* Remember input filename      */
+                strncpy(work, useargv[1], NWORK+1);  /* Remember input filename      */
+                work[NWORK] = '\0';
                 break;
             }                           /* Else, just get stdin         */
         case 0:                         /* No args?                     */
diff --git a/sal/osl/unx/profile.c b/sal/osl/unx/profile.c
index 0379070..d453266 100644
--- a/sal/osl/unx/profile.c
+++ b/sal/osl/unx/profile.c
@@ -2065,6 +2065,7 @@ static sal_Bool osl_ProfileSwapProfileNames(osl_TProfileImpl* pProfile)
       osl_ProfileGenerateExtension(pProfile->m_FileName,"bak",pszBakFile);
 
     strncpy(pszIniFile,pProfile->m_FileName,PATH_MAX);
+    pszIniFile[PATH_MAX-1] = '\0';
 
     osl_ProfileGenerateExtension(pProfile->m_FileName,"tmp",pszTmpFile);
 


More information about the Libreoffice-commits mailing list