Skip to content

Commit

Permalink
Remember to NULL terminate when using strncpy.
Browse files Browse the repository at this point in the history
All systems should have strlcpy.


git-svn-id: https://svn.apache.org/repos/asf/openoffice/trunk@1720862 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
pgiffuni committed Dec 19, 2015
1 parent 0739618 commit cf09c87
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion main/rsc/source/rscpp/cpp1.c
Original file line number Diff line number Diff line change
Expand Up @@ -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? */
Expand Down
1 change: 1 addition & 0 deletions main/sal/osl/unx/profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit cf09c87

Please sign in to comment.