aec4c941c3
this is version 2.1.6, from and maintained by William Yodlowsky <bsd at openbsd.rutgers.edu>
66 lines
1.9 KiB
Plaintext
66 lines
1.9 KiB
Plaintext
$OpenBSD: patch-src_item-file_c,v 1.1 2004/06/17 11:21:43 sturm Exp $
|
|
--- src/item-file.c.orig 2004-06-10 10:50:04.000000000 -0400
|
|
+++ src/item-file.c 2004-06-10 13:49:58.000000000 -0400
|
|
@@ -107,19 +107,19 @@ if (stat(file,&statbuf) == -1)
|
|
return false;
|
|
}
|
|
|
|
-strcpy(new,file);
|
|
-strcat(new,CF_EDITED);
|
|
+(void)strlcpy(new,file,sizeof(new));
|
|
+(void)strlcat(new,CF_EDITED,sizeof(new));
|
|
|
|
-strcpy(backup,file);
|
|
+(void)strlcpy(backup,file,sizeof(backup));
|
|
|
|
-sprintf(stamp, "_%d_%s", CFSTARTTIME, CanonifyName(ctime(&STAMPNOW)));
|
|
+(void)snprintf(stamp, sizeof(stamp), "_%d_%s", CFSTARTTIME, CanonifyName(ctime(&STAMPNOW)));
|
|
|
|
if (IMAGEBACKUP == 's')
|
|
{
|
|
- strcat(backup,stamp);
|
|
+ (void)strlcat(backup,stamp,sizeof(backup));
|
|
}
|
|
|
|
-strcat(backup,CF_SAVED);
|
|
+(void)strlcat(backup,CF_SAVED,sizeof(backup));
|
|
|
|
unlink(new); /* Just in case of races */
|
|
|
|
@@ -258,6 +258,7 @@ void InsertFileAfter (struct Item **file
|
|
char *sp;
|
|
FILE *fp;
|
|
char linebuf[CF_BUFSIZE];
|
|
+ size_t splen;
|
|
|
|
EditVerbose("Edit: Inserting file %s \n",string);
|
|
|
|
@@ -275,7 +276,8 @@ while(!feof(fp) && ReadLine(linebuf,CF_B
|
|
FatalError("");
|
|
}
|
|
|
|
- if ((sp = malloc(strlen(linebuf)+1)) == NULL)
|
|
+ splen = strlen(linebuf)+1;
|
|
+ if ((sp = malloc(splen)) == NULL)
|
|
{
|
|
CfLog(cferror,"","Can't allocate memory in InsertItemAfter()");
|
|
FatalError("");
|
|
@@ -294,7 +296,7 @@ while(!feof(fp) && ReadLine(linebuf,CF_B
|
|
(*filestart)->next = ip;
|
|
}
|
|
|
|
- strcpy(sp,linebuf);
|
|
+ (void)strlcpy(sp,linebuf,splen);
|
|
ip->name = sp;
|
|
ip->classes = NULL;
|
|
CURRENTLINEPTR = ip;
|
|
@@ -306,7 +308,7 @@ while(!feof(fp) && ReadLine(linebuf,CF_B
|
|
CURRENTLINEPTR->next = ip;
|
|
CURRENTLINEPTR=ip;
|
|
CURRENTLINENUMBER++;
|
|
- strcpy(sp,linebuf);
|
|
+ (void)strlcpy(sp,linebuf,splen);
|
|
ip->name = sp;
|
|
ip->classes = NULL;
|
|
}
|