$OpenBSD: patch-src_misc_c,v 1.3 2004/10/01 21:22:15 sturm Exp $
--- src/misc.c.orig	Fri Jul 30 15:06:17 2004
+++ src/misc.c	Fri Oct  1 23:14:49 2004
@@ -556,17 +556,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; 
@@ -942,17 +942,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);
     }
  
@@ -1071,15 +1071,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;
        };
     }
@@ -1087,21 +1087,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);
        }
     }
@@ -1175,19 +1175,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);
     }
  
@@ -1300,8 +1300,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
        {
@@ -1313,15 +1313,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);
        }
     }
