2ab61c64c1
inputs and ok naddy@
389 lines
13 KiB
Plaintext
389 lines
13 KiB
Plaintext
$OpenBSD: patch-src_varstring_c,v 1.4 2005/07/21 15:16:47 aanriot Exp $
|
|
--- src/varstring.c.orig Wed Apr 20 13:11:14 2005
|
|
+++ src/varstring.c Fri Jul 15 13:36:19 2005
|
|
@@ -354,7 +354,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
FatalError("Can't expand varstring");
|
|
}
|
|
|
|
- strcat(buffer,currentitem);
|
|
+ (void)strlcat(buffer,currentitem,CF_EXPANDSIZE);
|
|
sp += strlen(currentitem);
|
|
|
|
if (*sp == '$')
|
|
@@ -368,7 +368,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
varstring = '}';
|
|
break;
|
|
default:
|
|
- strcat(buffer,"$");
|
|
+ (void)strlcat(buffer,"$",CF_EXPANDSIZE);
|
|
continue;
|
|
}
|
|
sp++;
|
|
@@ -406,7 +406,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
FatalError("Can't expand varstring");
|
|
}
|
|
- strcat(buffer,VERSION);
|
|
+ (void)strlcat(buffer,VERSION,CF_EXPANDSIZE);
|
|
break;
|
|
|
|
case cffaculty:
|
|
@@ -420,7 +420,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
FatalError("Can't expand varstring");
|
|
}
|
|
- strcat(buffer,VFACULTY);
|
|
+ (void)strlcat(buffer,VFACULTY,CF_EXPANDSIZE);
|
|
break;
|
|
|
|
|
|
@@ -431,7 +431,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
FatalError("Can't expand varstring");
|
|
}
|
|
- strcat(buffer,VDEFAULTBINSERVER.name);
|
|
+ (void)strlcat(buffer,VDEFAULTBINSERVER.name,CF_EXPANDSIZE);
|
|
}
|
|
else
|
|
{
|
|
@@ -439,7 +439,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
FatalError("Can't expand varstring");
|
|
}
|
|
- strcat(buffer,VUQNAME);
|
|
+ (void)strlcat(buffer,VUQNAME,CF_EXPANDSIZE);
|
|
}
|
|
break;
|
|
|
|
@@ -448,7 +448,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
FatalError("Can't expand varstring");
|
|
}
|
|
- strcat(buffer,VFQNAME);
|
|
+ (void)strlcat(buffer,VFQNAME,CF_MAXVARSIZE);
|
|
break;
|
|
|
|
case cfnetmask:
|
|
@@ -456,7 +456,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
FatalError("Can't expand varstring");
|
|
}
|
|
- strcat(buffer,VNETMASK);
|
|
+ (void)strlcat(buffer,VNETMASK,CF_EXPANDSIZE);
|
|
break;
|
|
|
|
|
|
@@ -465,7 +465,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
FatalError("Can't expand varstring");
|
|
}
|
|
- strcat(buffer,VIPADDRESS);
|
|
+ (void)strlcat(buffer,VIPADDRESS,CF_EXPANDSIZE);
|
|
break;
|
|
|
|
case cfbinserver:
|
|
@@ -479,7 +479,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
FatalError("Can't expand varstring");
|
|
}
|
|
- strcat(buffer,"$(binserver)");
|
|
+ (void)strlcat(buffer,"$(binserver)",CF_EXPANDSIZE);
|
|
break;
|
|
|
|
case cfsysadm:
|
|
@@ -492,7 +492,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
FatalError("Can't expand varstring");
|
|
}
|
|
- strcat(buffer,VSYSADM);
|
|
+ (void)strlcat(buffer,VSYSADM,CF_EXPANDSIZE);
|
|
break;
|
|
|
|
case cfdomain:
|
|
@@ -505,7 +505,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
FatalError("Can't expandvarstring");
|
|
}
|
|
- strcat(buffer,ToLowerStr(VDOMAIN));
|
|
+ (void)strlcat(buffer,ToLowerStr(VDOMAIN),CF_EXPANDSIZE);
|
|
break;
|
|
|
|
case cfnfstype:
|
|
@@ -513,7 +513,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
FatalError("Can't expandvarstring");
|
|
}
|
|
- strcat(buffer,VNFSTYPE);
|
|
+ (void)strlcat(buffer,VNFSTYPE,CF_EXPANDSIZE);
|
|
break;
|
|
|
|
case cftimezone:
|
|
@@ -526,7 +526,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
FatalError("Can't expandvarstring");
|
|
}
|
|
- strcat(buffer,VTIMEZONE->name);
|
|
+ (void)strlcat(buffer,VTIMEZONE->name,CF_EXPANDSIZE);
|
|
break;
|
|
|
|
case cfclass:
|
|
@@ -534,7 +534,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
FatalError("Can't expandvarstring");
|
|
}
|
|
- strcat(buffer,CLASSTEXT[VSYSTEMHARDCLASS]);
|
|
+ (void)strlcat(buffer,CLASSTEXT[VSYSTEMHARDCLASS],CF_EXPANDSIZE);
|
|
break;
|
|
|
|
case cfarch:
|
|
@@ -542,7 +542,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
FatalError("Can't expandvarstring");
|
|
}
|
|
- strcat(buffer,VARCH);
|
|
+ (void)strlcat(buffer,VARCH,CF_EXPANDSIZE);
|
|
break;
|
|
|
|
case cfarch2:
|
|
@@ -550,7 +550,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
FatalError("Can't expandvarstring");
|
|
}
|
|
- strcat(buffer,VARCH2);
|
|
+ (void)strlcat(buffer,VARCH2,CF_EXPANDSIZE);
|
|
break;
|
|
|
|
|
|
@@ -568,7 +568,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
}
|
|
else
|
|
{
|
|
- strcat(buffer,Space2Score(ctime(&tloc)));
|
|
+ (void)strlcat(buffer,Space2Score(ctime(&tloc)),CF_EXPANDSIZE);
|
|
Chop(buffer);
|
|
}
|
|
|
|
@@ -581,7 +581,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
}
|
|
else
|
|
{
|
|
- strcat(buffer,VYEAR);
|
|
+ (void)strlcat(buffer,VYEAR,CF_EXPANDSIZE);
|
|
}
|
|
break;
|
|
|
|
@@ -592,7 +592,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
}
|
|
else
|
|
{
|
|
- strcat(buffer,VMONTH);
|
|
+ (void)strlcat(buffer,VMONTH,CF_EXPANDSIZE);
|
|
}
|
|
break;
|
|
|
|
@@ -603,7 +603,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
}
|
|
else
|
|
{
|
|
- strcat(buffer,VDAY);
|
|
+ (void)strlcat(buffer,VDAY,CF_EXPANDSIZE);
|
|
}
|
|
break;
|
|
case cfhr:
|
|
@@ -613,7 +613,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
}
|
|
else
|
|
{
|
|
- strcat(buffer,VHR);
|
|
+ (void)strlcat(buffer,VHR,CF_EXPANDSIZE);
|
|
}
|
|
break;
|
|
|
|
@@ -624,7 +624,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
}
|
|
else
|
|
{
|
|
- strcat(buffer,VMINUTE);
|
|
+ (void)strlcat(buffer,VMINUTE,CF_EXPANDSIZE);
|
|
}
|
|
break;
|
|
|
|
@@ -632,14 +632,14 @@ for (sp = string; /* No exit */ ; sp++)
|
|
if (strlen(ALLCLASSBUFFER) == 0)
|
|
{
|
|
snprintf(name,CF_MAXVARSIZE,"$(%s)",currentitem);
|
|
- strcat(buffer,name);
|
|
+ (void)strlcat(buffer,name,CF_EXPANDSIZE);
|
|
}
|
|
|
|
if (ExpandOverflow(buffer,ALLCLASSBUFFER))
|
|
{
|
|
FatalError("Can't expandvarstring");
|
|
}
|
|
- strcat(buffer,ALLCLASSBUFFER);
|
|
+ (void)strlcat(buffer,ALLCLASSBUFFER,CF_EXPANDSIZE);
|
|
break;
|
|
|
|
case cfspc:
|
|
@@ -647,7 +647,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
FatalError("Can't expandvarstring");
|
|
}
|
|
- strcat(buffer," ");
|
|
+ (void)strlcat(buffer," ",CF_EXPANDSIZE);
|
|
break;
|
|
|
|
case cftab:
|
|
@@ -655,7 +655,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
FatalError("Can't expandvarstring");
|
|
}
|
|
- strcat(buffer,"\t");
|
|
+ (void)strlcat(buffer,"\t",CF_EXPANDSIZE);
|
|
break;
|
|
|
|
case cflf:
|
|
@@ -663,7 +663,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
FatalError("Can't expandvarstring");
|
|
}
|
|
- strcat(buffer,"\012");
|
|
+ (void)strlcat(buffer,"\012",CF_EXPANDSIZE);
|
|
break;
|
|
|
|
case cfcr:
|
|
@@ -671,7 +671,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
FatalError("Can't expandvarstring");
|
|
}
|
|
- strcat(buffer,"\015");
|
|
+ (void)strlcat(buffer,"\015",CF_EXPANDSIZE);
|
|
break;
|
|
|
|
case cfn:
|
|
@@ -679,7 +679,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
FatalError("Can't expandvarstring");
|
|
}
|
|
- strcat(buffer,"\n");
|
|
+ (void)strlcat(buffer,"\n",CF_EXPANDSIZE);
|
|
break;
|
|
|
|
case cfdblquote:
|
|
@@ -687,14 +687,14 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
FatalError("Can't expandvarstring");
|
|
}
|
|
- strcat(buffer,"\"");
|
|
+ (void)strlcat(buffer,"\"",CF_EXPANDSIZE);
|
|
break;
|
|
case cfquote:
|
|
if (ExpandOverflow(buffer," "))
|
|
{
|
|
FatalError("Can't expandvarstring");
|
|
}
|
|
- strcat(buffer,"\'");
|
|
+ (void)strlcat(buffer,"\'",CF_EXPANDSIZE);
|
|
break;
|
|
|
|
case cfcolon:
|
|
@@ -702,7 +702,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
FatalError("Can't expandvarstring");
|
|
}
|
|
- strcat(buffer,":");
|
|
+ (void)strlcat(buffer,":",CF_EXPANDSIZE);
|
|
break;
|
|
|
|
|
|
@@ -714,7 +714,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
FatalError("Can't expandvarstring");
|
|
}
|
|
- strcat(buffer,"$");
|
|
+ (void)strlcat(buffer,"$",CF_EXPANDSIZE);
|
|
}
|
|
else
|
|
{
|
|
@@ -722,7 +722,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
FatalError("Can't expandvarstring");
|
|
}
|
|
- strcat(buffer,"$(dollar)");
|
|
+ (void)strlcat(buffer,"$(dollar)",CF_EXPANDSIZE);
|
|
}
|
|
break;
|
|
|
|
@@ -744,7 +744,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
FatalError("Can't expandvarstring");
|
|
}
|
|
- strcat(buffer,VREPOSITORY);
|
|
+ (void)strlcat(buffer,VREPOSITORY,CF_EXPANDSIZE);
|
|
}
|
|
break;
|
|
|
|
@@ -766,7 +766,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
FatalError("Can't expandvarstring");
|
|
}
|
|
- strcat(buffer,env);
|
|
+ (void)strlcat(buffer,env,CF_EXPANDSIZE);
|
|
Debug("Expansion gave (%s)\n",buffer);
|
|
|
|
break;
|
|
@@ -782,7 +782,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
snprintf(name,CF_MAXVARSIZE,"$(%s)",currentitem);
|
|
}
|
|
- strcat(buffer,name);
|
|
+ (void)strlcat(buffer,name,CF_EXPANDSIZE);
|
|
}
|
|
|
|
sp += strlen(currentitem);
|
|
@@ -816,7 +816,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
|
|
sscanf(sp,"%[^$]",currentitem);
|
|
|
|
- strcat(buffer,currentitem);
|
|
+ (void)strlcat(buffer,currentitem,CF_EXPANDSIZE);
|
|
sp += strlen(currentitem);
|
|
|
|
if (*sp == '$')
|
|
@@ -830,7 +830,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
varstring = '}';
|
|
break;
|
|
default:
|
|
- strcat(buffer,"$");
|
|
+ (void)strlcat(buffer,"$",CF_EXPANDSIZE);
|
|
continue;
|
|
}
|
|
sp++;
|
|
@@ -844,7 +844,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
}
|
|
else
|
|
{
|
|
- sprintf(scanstr,"%%[^%c]",varstring); /* select the correct terminator */
|
|
+ (void)snprintf(scanstr,sizeof(scanstr),"%%[^%c]",varstring); /* select the correct terminator */
|
|
sscanf(++sp,scanstr,currentitem); /* reduce item */
|
|
|
|
switch (ScanVariable(currentitem))
|
|
@@ -854,7 +854,7 @@ for (sp = string; /* No exit */ ; sp++)
|
|
{
|
|
FatalError("Can't expand varstring");
|
|
}
|
|
- strcat(buffer,bserver);
|
|
+ (void)strlcat(buffer,bserver,CF_EXPANDSIZE);
|
|
break;
|
|
}
|
|
|
|
@@ -915,7 +915,7 @@ if (!IsVarString(varstring))
|
|
return liststart;
|
|
}
|
|
|
|
-sprintf(format,"%%[^%c]",sep); /* set format string to search */
|
|
+(void)snprintf(format,sizeof(format),"%%[^%c]",sep); /* set format string to search */
|
|
|
|
i = 0; /* extract variable */
|
|
|