fec479ae4c
problem but is not used anywhere and will probably be removed from cfengine from maintainer William Yodlowsky <bsd at openbsd.rutgers.edu>
170 lines
5.5 KiB
Plaintext
170 lines
5.5 KiB
Plaintext
$OpenBSD: patch-src_misc_c,v 1.5 2005/10/27 21:47:28 sturm Exp $
|
|
--- src/misc.c.orig Fri Jul 15 11:15:25 2005
|
|
+++ src/misc.c Fri Oct 21 16:35:56 2005
|
|
@@ -540,17 +540,17 @@ char *ChecksumPrint(char type,unsigned c
|
|
|
|
switch(type)
|
|
{
|
|
- case 's': sprintf(buffer,"SHA= ");
|
|
+ case 's': (void)snprintf(buffer,sizeof(buffer),"SHA= ");
|
|
len = 20;
|
|
break;
|
|
- case 'm': sprintf(buffer,"MD5= ");
|
|
+ case 'm': (void)snprintf(buffer,sizeof(buffer),"MD5= ");
|
|
len = 16;
|
|
break;
|
|
}
|
|
|
|
for (i = 0; i < len; i++)
|
|
{
|
|
- sprintf((char *)(buffer+4+2*i),"%02x", digest[i]);
|
|
+ (void)snprintf((char *)(buffer+4+2*i),sizeof(buffer),"%02x", digest[i]);
|
|
}
|
|
|
|
return buffer;
|
|
@@ -894,17 +894,17 @@ char strmajor[CF_MAXVARSIZE];
|
|
release += strlen(RELEASE_FLAG);
|
|
if (sscanf(release, "%d", &major) == 1)
|
|
{
|
|
- sprintf(strmajor, "%d", major);
|
|
+ (void)snprintf(strmajor, sizeof(strmajor), "%d", major);
|
|
}
|
|
}
|
|
|
|
if (major != -1 && vendor != "")
|
|
{
|
|
classbuf[0] = '\0';
|
|
- strcat(classbuf, vendor);
|
|
+ (void)strlcat(classbuf, vendor, sizeof(classbuf));
|
|
AddClassToHeap(classbuf);
|
|
- strcat(classbuf, "_");
|
|
- strcat(classbuf, strmajor);
|
|
+ (void)strlcat(classbuf, "_", sizeof(classbuf));
|
|
+ (void)strlcat(classbuf, strmajor, sizeof(classbuf));
|
|
AddClassToHeap(classbuf);
|
|
}
|
|
|
|
@@ -1062,15 +1062,15 @@ Verbose("Looking for redhat linux info i
|
|
release += strlen(RELEASE_FLAG);
|
|
if (sscanf(release, "%d.%d", &major, &minor) == 2)
|
|
{
|
|
- sprintf(strmajor, "%d", major);
|
|
- sprintf(strminor, "%d", minor);
|
|
+ (void)snprintf(strmajor, sizeof(strmajor), "%d", major);
|
|
+ (void)snprintf(strminor, sizeof(strminor), "%d", minor);
|
|
}
|
|
/* red hat 9 is *not* red hat 9.0.
|
|
* and same thing with RHEL AS 3
|
|
*/
|
|
else if (sscanf(release, "%d", &major) == 1)
|
|
{
|
|
- sprintf(strmajor, "%d", major);
|
|
+ (void)snprintf(strmajor, sizeof(strmajor), "%d", major);
|
|
minor = -2;
|
|
};
|
|
}
|
|
@@ -1078,21 +1078,21 @@ Verbose("Looking for redhat linux info i
|
|
if (major != -1 && minor != -1 && vendor != "")
|
|
{
|
|
classbuf[0] = '\0';
|
|
- strcat(classbuf, vendor);
|
|
+ (void)strlcat(classbuf, vendor, sizeof(classbuf));
|
|
AddClassToHeap(classbuf);
|
|
- strcat(classbuf, "_");
|
|
+ (void)strlcat(classbuf, "_", sizeof(classbuf));
|
|
if(edition != "")
|
|
{
|
|
- strcat(classbuf, edition);
|
|
+ (void)strlcat(classbuf, edition, sizeof(classbuf));
|
|
AddClassToHeap(classbuf);
|
|
- strcat(classbuf, "_");
|
|
+ (void)strlcat(classbuf, "_", sizeof(classbuf));
|
|
}
|
|
- strcat(classbuf, strmajor);
|
|
+ (void)strlcat(classbuf, strmajor, sizeof(classbuf));
|
|
AddClassToHeap(classbuf);
|
|
if (minor != -2)
|
|
{
|
|
- strcat(classbuf, "_");
|
|
- strcat(classbuf, strminor);
|
|
+ (void)strlcat(classbuf, "_", sizeof(classbuf));
|
|
+ (void)strlcat(classbuf, strminor, sizeof(classbuf));
|
|
AddClassToHeap(classbuf);
|
|
}
|
|
}
|
|
@@ -1139,13 +1139,13 @@ FILE *fp;
|
|
if(!strncmp(relstring, SUSE_SLES8_ID, strlen(SUSE_SLES8_ID)))
|
|
{
|
|
classbuf[0] = '\0';
|
|
- strcat(classbuf, "SLES8");
|
|
+ (void)strlcat(classbuf, "SLES8", sizeof(classbuf));
|
|
AddClassToHeap(classbuf);
|
|
}
|
|
else if(!strncmp(relstring, SUSE_SLES9_ID, strlen(SUSE_SLES9_ID)))
|
|
{
|
|
classbuf[0] = '\0';
|
|
- strcat(classbuf, "SLES9");
|
|
+ (void)strlcat(classbuf, "SLES9", sizeof(classbuf));
|
|
AddClassToHeap(classbuf);
|
|
}
|
|
|
|
@@ -1166,19 +1166,19 @@ FILE *fp;
|
|
{
|
|
release += strlen(SUSE_RELEASE_FLAG);
|
|
sscanf(release, "%d.%d", &major, &minor);
|
|
- sprintf(strmajor, "%d", major);
|
|
- sprintf(strminor, "%d", minor);
|
|
+ (void)snprintf(strmajor, sizeof(strmajor), "%d", major);
|
|
+ (void)snprintf(strminor, sizeof(strminor), "%d", minor);
|
|
}
|
|
if(major != -1 && minor != -1)
|
|
{
|
|
classbuf[0] = '\0';
|
|
- strcat(classbuf, "SuSE");
|
|
+ (void)strlcat(classbuf, "SuSE", sizeof(classbuf));
|
|
AddClassToHeap(classbuf);
|
|
- strcat(classbuf, "_");
|
|
- strcat(classbuf, strmajor);
|
|
+ (void)strlcat(classbuf, "_", sizeof(classbuf));
|
|
+ (void)strlcat(classbuf, strmajor, sizeof(classbuf));
|
|
AddClassToHeap(classbuf);
|
|
- strcat(classbuf, "_");
|
|
- strcat(classbuf, strminor);
|
|
+ (void)strlcat(classbuf, "_", sizeof(classbuf));
|
|
+ (void)strlcat(classbuf, strminor, sizeof(classbuf));
|
|
AddClassToHeap(classbuf);
|
|
}
|
|
|
|
@@ -1297,8 +1297,8 @@ char strminor[CF_MAXVARSIZE];
|
|
release += strlen(RELEASE_FLAG);
|
|
if (sscanf(release, "%d.%d", &major, &minor) == 2)
|
|
{
|
|
- sprintf(strmajor, "%d", major);
|
|
- sprintf(strminor, "%d", minor);
|
|
+ (void)snprintf(strmajor, sizeof(strmajor), "%d", major);
|
|
+ (void)snprintf(strminor, sizeof(strminor), "%d", minor);
|
|
}
|
|
else
|
|
{
|
|
@@ -1310,15 +1310,15 @@ char strminor[CF_MAXVARSIZE];
|
|
if (major != -1 && minor != -1 && vendor != "")
|
|
{
|
|
classbuf[0] = '\0';
|
|
- strcat(classbuf, vendor);
|
|
+ (void)strlcat(classbuf, vendor, sizeof(classbuf));
|
|
AddClassToHeap(classbuf);
|
|
- strcat(classbuf, "_");
|
|
- strcat(classbuf, strmajor);
|
|
+ (void)strlcat(classbuf, "_", sizeof(classbuf));
|
|
+ (void)strlcat(classbuf, strmajor, sizeof(classbuf));
|
|
AddClassToHeap(classbuf);
|
|
if (minor != -2)
|
|
{
|
|
- strcat(classbuf, "_");
|
|
- strcat(classbuf, strminor);
|
|
+ (void)strlcat(classbuf, "_", sizeof(classbuf));
|
|
+ (void)strlcat(classbuf, strminor, sizeof(classbuf));
|
|
AddClassToHeap(classbuf);
|
|
}
|
|
}
|