908a816
--- plugins/check_snmp.c.old	2007-05-29 07:22:32.000000000 +0200
908a816
+++ plugins/check_snmp.c	2007-10-17 22:08:49.000000000 +0200
908a816
@@ -219,12 +219,16 @@ main (int argc, char **argv)
908a816
 
908a816
 	ptr = output;
908a816
 
908a816
-	strcat(perfstr, "| ");
908a816
+	strncat(perfstr, "| ", sizeof(perfstr)-strlen(perfstr)-1);
908a816
 	while (ptr) {
908a816
 		char *foo;
908a816
+		unsigned int copylen;
908a816
 
908a816
 		foo = strstr (ptr, delimiter);
908a816
-		strncat(perfstr, ptr, foo-ptr);
908a816
+		copylen = foo-ptr;
908a816
+		if (copylen > sizeof(perfstr)-strlen(perfstr)-1)
908a816
+			copylen = sizeof(perfstr)-strlen(perfstr)-1;
908a816
+		strncat(perfstr, ptr, copylen);
908a816
 		ptr = foo; 
908a816
 
908a816
 		if (ptr == NULL)
908a816
@@ -357,11 +361,11 @@ main (int argc, char **argv)
908a816
 
908a816
 		i++;
908a816
 
908a816
-		strcat(perfstr, "=");
908a816
-		strcat(perfstr, show);
908a816
+		strncat(perfstr, "=", sizeof(perfstr)-strlen(perfstr)-1);
908a816
+		strncat(perfstr, show, sizeof(perfstr)-strlen(perfstr)-1);
908a816
 		if (type)
908a816
-			strcat(perfstr, type);
908a816
-		strcat(perfstr, " ");
908a816
+			strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1);
908a816
+		strncat(perfstr, " ", sizeof(perfstr)-strlen(perfstr)-1);
908a816
 
908a816
 	}	/* end while (ptr) */
908a816