2ab61c64c1
inputs and ok naddy@
60 lines
2.0 KiB
Plaintext
60 lines
2.0 KiB
Plaintext
$OpenBSD: patch-src_tidy_c,v 1.2 2005/07/21 15:16:47 aanriot Exp $
|
|
--- src/tidy.c.orig Mon Apr 4 04:54:12 2005
|
|
+++ src/tidy.c Fri Jul 15 12:24:01 2005
|
|
@@ -76,8 +76,8 @@ if (level == 2)
|
|
if (LOGTIDYHOMEFILES)
|
|
{
|
|
int tempfd;
|
|
- strcpy(VLOGFILE,name);
|
|
- strcat(VLOGFILE,"/.cfengine.rm");
|
|
+ (void)strlcpy(VLOGFILE,name,CF_BUFSIZE);
|
|
+ (void)strlcat(VLOGFILE,"/.cfengine.rm",CF_BUFSIZE);
|
|
|
|
/* Unlink here to avoid an exploit which could be used to
|
|
overwrite a system file with root privileges. */
|
|
@@ -95,7 +95,7 @@ if (level == 2)
|
|
}
|
|
else if ((VLOGFP = fdopen(tempfd,"w")) == NULL)
|
|
{
|
|
- sprintf(OUTPUT,"Couldn't open a file %s\n",VLOGFILE);
|
|
+ (void)snprintf(OUTPUT,sizeof(OUTPUT),"Couldn't open a file %s\n",VLOGFILE);
|
|
CfLog(cferror,OUTPUT,"fdopen");
|
|
VLOGFP = stderr;
|
|
}
|
|
@@ -123,7 +123,7 @@ for (dirp = readdir(dirh); dirp != NULL;
|
|
continue;
|
|
}
|
|
|
|
- strcpy(pcwd,name); /* Assemble pathname */
|
|
+ (void)strlcpy(pcwd,name,sizeof(pcwd)); /* Assemble pathname */
|
|
AddSlash(pcwd);
|
|
|
|
if (BufferOverflow(pcwd,dirp->d_name))
|
|
@@ -131,7 +131,7 @@ for (dirp = readdir(dirh); dirp != NULL;
|
|
return true;
|
|
}
|
|
|
|
- strcat(pcwd,dirp->d_name);
|
|
+ (void)strlcat(pcwd,dirp->d_name,sizeof(pcwd));
|
|
|
|
if (TRAVLINKS)
|
|
{
|
|
@@ -398,7 +398,7 @@ for (dirp = readdir(dirh); dirp != NULL;
|
|
continue;
|
|
}
|
|
|
|
- strcpy(pcwd,name); /* Assemble pathname */
|
|
+ (void)strlcpy(pcwd,name,sizeof(pcwd)); /* Assemble pathname */
|
|
AddSlash(pcwd);
|
|
|
|
if (BufferOverflow(pcwd,dirp->d_name))
|
|
@@ -408,7 +408,7 @@ for (dirp = readdir(dirh); dirp != NULL;
|
|
|
|
level = tp->maxrecurse - maxrecurse;
|
|
|
|
- strcat(pcwd,dirp->d_name);
|
|
+ (void)strlcat(pcwd,dirp->d_name,sizeof(pcwd));
|
|
|
|
if (lstat(dirp->d_name,&statbuf) == -1) /* Check for links first */
|
|
{
|