openbsd-ports/sysutils/cfengine/patches/patch-src_eval_c
sturm 6b4e484130 unbreak and update to 2.1.10
from maintainer William Yodlowsky <bsd at openbsd.rutgers.edu>
2004-10-01 21:22:15 +00:00

85 lines
2.4 KiB
Plaintext

$OpenBSD: patch-src_eval_c,v 1.3 2004/10/01 21:22:15 sturm Exp $
--- src/eval.c.orig Wed Aug 11 00:50:29 2004
+++ src/eval.c Fri Oct 1 23:14:47 2004
@@ -253,7 +253,7 @@ sscanf(str,"%*s %s %s %s %s",buf2,buf3,b
/* Hours */
sscanf(buf4,"%[^:]",buf);
-sprintf(out,"Hr%s",buf);
+(void)snprintf(out,sizeof(out),"Hr%s",buf);
AddClassToHeap(out);
memset(VHR,0,3);
strncpy(VHR,buf,2);
@@ -261,7 +261,7 @@ strncpy(VHR,buf,2);
/* Minutes */
sscanf(buf4,"%*[^:]:%[^:]",buf);
-sprintf(out,"Min%s",buf);
+(void)snprintf(out,sizeof(out),"Min%s",buf);
AddClassToHeap(out);
memset(VMINUTE,0,3);
strncpy(VMINUTE,buf,2);
@@ -301,19 +301,19 @@ switch ((i / 5))
switch ((i / 15))
{
case 0: AddClassToHeap("Q1");
- sprintf(out,"Hr%s_Q1",VHR);
+ (void)snprintf(out,sizeof(out),"Hr%s_Q1",VHR);
AddClassToHeap(out);
break;
case 1: AddClassToHeap("Q2");
- sprintf(out,"Hr%s_Q2",VHR);
+ (void)snprintf(out,sizeof(out),"Hr%s_Q2",VHR);
AddClassToHeap(out);
break;
case 2: AddClassToHeap("Q3");
- sprintf(out,"Hr%s_Q3",VHR);
+ (void)snprintf(out,sizeof(out),"Hr%s_Q3",VHR);
AddClassToHeap(out);
break;
case 3: AddClassToHeap("Q4");
- sprintf(out,"Hr%s_Q4",VHR);
+ (void)snprintf(out,sizeof(out),"Hr%s_Q4",VHR);
AddClassToHeap(out);
break;
}
@@ -321,7 +321,7 @@ switch ((i / 15))
/* Day */
-sprintf(out,"Day%s",buf3);
+(void)snprintf(out,sizeof(out),"Day%s",buf3);
AddClassToHeap(out);
memset(VDAY,0,3);
strncpy(VDAY,buf3,2);
@@ -341,9 +341,9 @@ for (i = 0; i < 12; i++)
/* Year */
-strcpy(VYEAR,buf5);
+strncpy(VYEAR,buf5,4);
-sprintf(out,"Yr%s",buf5);
+(void)snprintf(out,sizeof(out),"Yr%s",buf5);
AddClassToHeap(out);
}
@@ -589,7 +589,7 @@ while(*sp != '\0')
if (IsHardClass(cbuff))
{ char err[CF_BUFSIZE];
yyerror("Illegal exception");
- sprintf (err,"Cannot negate the reserved class [%s]\n",cbuff);
+ (void)snprintf (err,sizeof(err),"Cannot negate the reserved class [%s]\n",cbuff);
FatalError(err);
}
@@ -899,7 +899,7 @@ for (sp = class; *sp != '\0'; sp++)
if (bracklevel != 0)
{
- sprintf(OUTPUT,"Bracket mismatch, in [class=%s], level = %d\n",class,bracklevel);
+ (void)snprintf(OUTPUT,sizeof(OUTPUT),"Bracket mismatch, in [class=%s], level = %d\n",class,bracklevel);
yyerror(OUTPUT);;
FatalError("Aborted");
}