Kaydet (Commit) dcfb7880 authored tarafından Pedro Giffuni's avatar Pedro Giffuni

Remember to NULL terminate when using strncpy.

All systems should have strlcpy.
üst cbd43d0c
...@@ -329,7 +329,8 @@ nRunde++; ...@@ -329,7 +329,8 @@ nRunde++;
cerror("Can't open input file \"%s\"", useargv[1]); cerror("Can't open input file \"%s\"", useargv[1]);
exit(IO_ERROR); 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; break;
} /* Else, just get stdin */ } /* Else, just get stdin */
case 0: /* No args? */ case 0: /* No args? */
......
...@@ -2065,6 +2065,7 @@ static sal_Bool osl_ProfileSwapProfileNames(osl_TProfileImpl* pProfile) ...@@ -2065,6 +2065,7 @@ static sal_Bool osl_ProfileSwapProfileNames(osl_TProfileImpl* pProfile)
osl_ProfileGenerateExtension(pProfile->m_FileName,"bak",pszBakFile); osl_ProfileGenerateExtension(pProfile->m_FileName,"bak",pszBakFile);
strncpy(pszIniFile,pProfile->m_FileName,PATH_MAX); strncpy(pszIniFile,pProfile->m_FileName,PATH_MAX);
pszIniFile[PATH_MAX-1] = '\0';
osl_ProfileGenerateExtension(pProfile->m_FileName,"tmp",pszTmpFile); osl_ProfileGenerateExtension(pProfile->m_FileName,"tmp",pszTmpFile);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment