181 lines
5.4 KiB
Plaintext
181 lines
5.4 KiB
Plaintext
$OpenBSD: patch-src_image_c,v 1.3 2004/10/01 21:22:15 sturm Exp $
|
|
--- src/image.c.orig Thu Aug 12 22:16:20 2004
|
|
+++ src/image.c Fri Oct 1 23:14:48 2004
|
|
@@ -57,8 +57,8 @@ Banner("Looking for remote method collab
|
|
}
|
|
else
|
|
{
|
|
- strcat(client,".");
|
|
- strcat(client,VDOMAIN);
|
|
+ (void)strlcat(client,".",sizeof(client));
|
|
+ (void)strlcat(client,VDOMAIN,sizeof(client));
|
|
}
|
|
|
|
Verbose(" Hailing remote peer %s\n",client);
|
|
@@ -81,8 +81,8 @@ Banner("Looking for remote method collab
|
|
MINUSMASK = 0377;
|
|
IMAGEBACKUP = 'n';
|
|
ENCRYPT = 'y';
|
|
- strcpy(IMAGEACTION,"fix");
|
|
- strcpy(CLASSBUFF,"any");
|
|
+ (void)strlcpy(IMAGEACTION,"fix",CF_BUFSIZE);
|
|
+ (void)strlcpy(CLASSBUFF,"any",CF_BUFSIZE);
|
|
snprintf(VUIDNAME,CF_MAXVARSIZE,"%d",getuid());
|
|
snprintf(VGIDNAME,CF_MAXVARSIZE,"%d",getgid());
|
|
IMGCOMP = '>';
|
|
@@ -189,7 +189,7 @@ for (dirp = cfreaddir(dirh,ip); dirp !=
|
|
return;
|
|
}
|
|
|
|
- strcat(newto,dirp->d_name);
|
|
+ (void)strlcat(newto,dirp->d_name,sizeof(newto));
|
|
|
|
if (TRAVLINKS || ip->linktype == 'n')
|
|
{
|
|
@@ -360,9 +360,9 @@ for (itp = VMOUNTLIST; itp != NULL; itp=
|
|
continue;
|
|
}
|
|
|
|
- strcpy(homedir,itp->name);
|
|
+ (void)strlcpy(homedir,itp->name,sizeof(homedir));
|
|
AddSlash(homedir);
|
|
- strcat(homedir,dirp->d_name);
|
|
+ (void)strlcat(homedir,dirp->d_name,sizeof(homedir));
|
|
|
|
if (! IsHomeDir(homedir))
|
|
{
|
|
@@ -383,10 +383,10 @@ for (itp = VMOUNTLIST; itp != NULL; itp=
|
|
continue;
|
|
}
|
|
|
|
- strcpy(username,dirp2->d_name);
|
|
- strcpy(dest,homedir);
|
|
+ (void)strlcpy(username,dirp2->d_name,sizeof(username));
|
|
+ (void)strlcpy(dest,homedir,sizeof(dest));
|
|
AddSlash(dest);
|
|
- strcat(dest,dirp2->d_name);
|
|
+ (void)strlcat(dest,dirp2->d_name,sizeof(dest));
|
|
|
|
if (strlen(ip->destination) > 4)
|
|
{
|
|
@@ -399,7 +399,7 @@ for (itp = VMOUNTLIST; itp != NULL; itp=
|
|
}
|
|
else
|
|
{
|
|
- strcat(dest,(ip->destination)+strlen("home/"));
|
|
+ (void)strlcat(dest,(ip->destination)+strlen("home/"),sizeof(dest));
|
|
}
|
|
}
|
|
|
|
@@ -501,9 +501,9 @@ if ((ip->gid)->gid == (gid_t)-1)
|
|
|
|
if (S_ISDIR(sourcestatbuf.st_mode))
|
|
{
|
|
- strcpy(sourcedir,source);
|
|
+ (void)strlcpy(sourcedir,source,sizeof(sourcedir));
|
|
AddSlash(sourcedir);
|
|
- strcpy(destdir,destination);
|
|
+ (void)strlcpy(destdir,destination,sizeof(destdir));
|
|
AddSlash(destdir);
|
|
|
|
if ((dirh = cfopendir(sourcedir,ip)) == NULL)
|
|
@@ -535,22 +535,22 @@ if (S_ISDIR(sourcestatbuf.st_mode))
|
|
continue;
|
|
}
|
|
|
|
- strcpy(sourcefile, sourcedir);
|
|
+ (void)strlcpy(sourcefile, sourcedir, sizeof(sourcefile));
|
|
|
|
if (BufferOverflow(sourcefile,dirp->d_name))
|
|
{
|
|
FatalError("Culprit: CheckImage");
|
|
}
|
|
|
|
- strcat(sourcefile, dirp->d_name);
|
|
- strcpy(destfile, destdir);
|
|
+ (void)strlcat(sourcefile, dirp->d_name, sizeof(sourcefile));
|
|
+ (void)strlcpy(destfile, destdir, sizeof(destfile));
|
|
|
|
if (BufferOverflow(destfile,dirp->d_name))
|
|
{
|
|
FatalError("Culprit: CheckImage");
|
|
}
|
|
|
|
- strcat(destfile, dirp->d_name);
|
|
+ (void)strlcat(destfile, dirp->d_name, sizeof(destfile));
|
|
|
|
if (cflstat(sourcefile,&sourcestatbuf,ip) == -1)
|
|
{
|
|
@@ -571,8 +571,8 @@ if (S_ISDIR(sourcestatbuf.st_mode))
|
|
return;
|
|
}
|
|
|
|
- strcpy(sourcefile,source);
|
|
- strcpy(destfile,destination);
|
|
+ (void)strlcpy(sourcefile,source,sizeof(sourcefile));
|
|
+ (void)strlcpy(destfile,destination,sizeof(destfile));
|
|
|
|
ImageCopy(sourcefile,destfile,sourcestatbuf,ip);
|
|
(ip->uid)->uid = save_uid;
|
|
@@ -1007,7 +1007,7 @@ if (ip->linktype != 'n')
|
|
|
|
if (ip->linktype == 'a' && linkbuf[0] != '/') /* Not absolute path - must fix */
|
|
{
|
|
- strcpy(VBUFF,sourcefile);
|
|
+ (void)strlcpy(VBUFF,sourcefile,sizeof(VBUFF));
|
|
ChopLastNode(VBUFF);
|
|
AddSlash(VBUFF);
|
|
strncat(VBUFF,linkbuf,CF_BUFSIZE-1);
|
|
@@ -1383,7 +1383,7 @@ for (sp = ip->cache; sp != NULL; sp=sp->
|
|
else
|
|
{
|
|
memset(linkbuf,0,buffsize);
|
|
- strcpy(linkbuf,sp->cf_readlink);
|
|
+ (void)strlcpy(linkbuf,sp->cf_readlink,buffsize);
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -1571,13 +1571,13 @@ if (BufferOverflow(dest,CF_NEW))
|
|
printf(" culprit: CopyReg\n");
|
|
return false;
|
|
}
|
|
-strcpy(new,dest);
|
|
+(void)strlcpy(new,dest,sizeof(new));
|
|
|
|
#ifdef DARWIN
|
|
}
|
|
#endif
|
|
|
|
-strcat(new,CF_NEW);
|
|
+(void)strlcat(new,CF_NEW,sizeof(new));
|
|
|
|
if (remote)
|
|
{
|
|
@@ -1616,22 +1616,22 @@ if (IMAGEBACKUP != 'n')
|
|
time_t STAMPNOW;
|
|
STAMPNOW = time((time_t *)NULL);
|
|
|
|
- sprintf(stamp, "_%d_%s", CFSTARTTIME, CanonifyName(ctime(&STAMPNOW)));
|
|
+ (void)snprintf(stamp, sizeof(stamp), "_%d_%s", CFSTARTTIME, CanonifyName(ctime(&STAMPNOW)));
|
|
|
|
if (BufferOverflow(dest,stamp))
|
|
{
|
|
printf(" culprit: CopyReg\n");
|
|
return false;
|
|
}
|
|
- strcpy(backup,dest);
|
|
+ (void)strlcpy(backup,dest,sizeof(backup));
|
|
|
|
if (IMAGEBACKUP == 's')
|
|
{
|
|
- strcat(backup,stamp);
|
|
+ (void)strlcat(backup,stamp,sizeof(backup));
|
|
}
|
|
|
|
/* rely on prior BufferOverflow() and on strlen(CF_SAVED) < CF_BUFFERMARGIN */
|
|
- strcat(backup,CF_SAVED);
|
|
+ (void)strlcat(backup,CF_SAVED,sizeof(backup));
|
|
|
|
if (IsItemIn(VREPOSLIST,backup))
|
|
{
|