openbsd-ports/sysutils/cfengine/patches/patch-src_granules_c
sturm aec4c941c3 revive cfengine port
this is version 2.1.6, from and maintained by
William Yodlowsky <bsd at openbsd.rutgers.edu>
2004-06-17 11:21:42 +00:00

78 lines
2.4 KiB
Plaintext

$OpenBSD: patch-src_granules_c,v 1.1 2004/06/17 11:21:43 sturm Exp $
--- src/granules.c.orig 2004-06-10 23:26:55.000000000 -0400
+++ src/granules.c 2004-06-10 23:03:34.000000000 -0400
@@ -49,47 +49,47 @@ timekey[0] = '\0';
/* Day */
-sprintf(timekey,"%s:",buf1);
+(void)snprintf(timekey,sizeof(timekey),"%s:",buf1);
/* Hours */
sscanf(buf4,"%[^:]",buf);
-sprintf(out,"Hr%s",buf);
-strcat(timekey,out);
+(void)snprintf(out,sizeof(out),"Hr%s",buf);
+(void)strlcat(timekey,out,sizeof(timekey));
/* Minutes */
sscanf(buf4,"%*[^:]:%[^:]",buf);
-sprintf(out,"Min%s",buf);
-strcat(timekey,":");
+(void)snprintf(out,sizeof(out),"Min%s",buf);
+(void)strlcat(timekey,":",sizeof(timekey));
sscanf(buf,"%d",&i);
switch ((i / 5))
{
- case 0: strcat(timekey,"Min00_05");
+ case 0: (void)strlcat(timekey,"Min00_05",sizeof(timekey));
break;
- case 1: strcat(timekey,"Min05_10");
+ case 1: (void)strlcat(timekey,"Min05_10",sizeof(timekey));
break;
- case 2: strcat(timekey,"Min10_15");
+ case 2: (void)strlcat(timekey,"Min10_15",sizeof(timekey));
break;
- case 3: strcat(timekey,"Min15_20");
+ case 3: (void)strlcat(timekey,"Min15_20",sizeof(timekey));
break;
- case 4: strcat(timekey,"Min20_25");
+ case 4: (void)strlcat(timekey,"Min20_25",sizeof(timekey));
break;
- case 5: strcat(timekey,"Min25_30");
+ case 5: (void)strlcat(timekey,"Min25_30",sizeof(timekey));
break;
- case 6: strcat(timekey,"Min30_35");
+ case 6: (void)strlcat(timekey,"Min30_35",sizeof(timekey));
break;
- case 7: strcat(timekey,"Min35_40");
+ case 7: (void)strlcat(timekey,"Min35_40",sizeof(timekey));
break;
- case 8: strcat(timekey,"Min40_45");
+ case 8: (void)strlcat(timekey,"Min40_45",sizeof(timekey));
break;
- case 9: strcat(timekey,"Min45_50");
+ case 9: (void)strlcat(timekey,"Min45_50",sizeof(timekey));
break;
- case 10: strcat(timekey,"Min50_55");
+ case 10: (void)strlcat(timekey,"Min50_55",sizeof(timekey));
break;
- case 11: strcat(timekey,"Min55_00");
+ case 11: (void)strlcat(timekey,"Min55_00",sizeof(timekey));
break;
}
@@ -102,7 +102,7 @@ char *GenTimeKey(time_t now)
{ char str[64];
-sprintf(str,"%s",ctime(&now));
+(void)snprintf(str,sizeof(str),"%s",ctime(&now));
return ConvTimeKey(str);
}