openbsd-ports/sysutils/cfengine/patches/patch-src_filenames_c
2005-07-21 15:16:46 +00:00

81 lines
2.2 KiB
Plaintext

$OpenBSD: patch-src_filenames_c,v 1.3 2005/07/21 15:16:46 aanriot Exp $
--- src/filenames.c.orig Tue Feb 8 06:50:01 2005
+++ src/filenames.c Fri Jul 15 12:24:01 2005
@@ -121,7 +121,7 @@ if (str == NULL)
if (!IsFileSep(str[strlen(str)-1]))
{
- strcat(str,FILE_SEPARATOR_STR);
+ (void)strlcat(str,FILE_SEPARATOR_STR,CF_BUFSIZE);
}
}
@@ -225,7 +225,7 @@ char *CanonifyName(char *str)
char *sp;
memset(buffer,0,CF_BUFSIZE);
-strcpy(buffer,str);
+(void)strlcpy(buffer,str,sizeof(buffer));
for (sp = buffer; *sp != '\0'; sp++)
{
@@ -246,7 +246,7 @@ char *Space2Score(char *str)
char *sp;
memset(buffer,0,CF_BUFSIZE);
-strcpy(buffer,str);
+(void)strlcpy(buffer,str,sizeof(buffer));
for (sp = buffer; *sp != '\0'; sp++)
{
@@ -267,7 +267,7 @@ char *ASUniqueName(char *str) /* generat
struct Item *ip;
memset(buffer,0,CF_BUFSIZE);
-strcpy(buffer,str);
+(void)strlcpy(buffer,str,sizeof(buffer));
for (ip = VADDCLASSES; ip != NULL; ip=ip->next)
{
@@ -276,8 +276,8 @@ for (ip = VADDCLASSES; ip != NULL; ip=ip
break;
}
- strcat(buffer,".");
- strcat(buffer,ip->name);
+ (void)strlcat(buffer,".",sizeof(buffer));
+ (void)strlcat(buffer,ip->name,sizeof(buffer));
}
return buffer;
@@ -371,9 +371,9 @@ if (strstr(pathbuf, _PATH_RSRCFORKSPEC)
return true;
}
- strcpy(currentpath,pathbuf);
+ (void)strlcpy(currentpath,pathbuf,sizeof(currentpath));
DeleteSlash(currentpath);
- strcat(currentpath,".cf-moved");
+ (void)strlcat(currentpath,".cf-moved",sizeof(currentpath));
snprintf(OUTPUT,CF_BUFSIZE,"Moving obstructing file/link %s to %s to make directory",pathbuf,currentpath);
CfLog(cferror,OUTPUT,"");
@@ -646,7 +646,7 @@ for (sp = src+rootlen; *sp != '\0'; sp++
return false;
}
- strcat(dest,node);
+ (void)strlcat(dest,node,CF_BUFSIZE);
}
return true;
@@ -708,7 +708,7 @@ if (strlen(str) >= CF_BUFSIZE)
{
char *tmp;
tmp = malloc(40+strlen(str));
- sprintf(tmp,"String too long in ToUpperStr: %s",str);
+ snprintf(tmp,CF_BUFSIZE,"String too long in ToUpperStr: %s",str);
FatalError(tmp);
}