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