summaryrefslogtreecommitdiffstats
path: root/plugins/check_snmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_snmp.c')
-rw-r--r--plugins/check_snmp.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 0acade25..544c5c0b 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -228,14 +228,14 @@ main (int argc, char **argv)
228 228
229 strncat(perfstr, "| ", sizeof(perfstr)-strlen(perfstr)-1); 229 strncat(perfstr, "| ", sizeof(perfstr)-strlen(perfstr)-1);
230 while (ptr) { 230 while (ptr) {
231 char *foo; 231 char *foo, *ptr2;
232 unsigned int copylen; 232 unsigned int copylen;
233 233
234 foo = strstr (ptr, delimiter); 234 foo = strstr (ptr, delimiter);
235 copylen = foo-ptr; 235 copylen = foo-ptr;
236 if (copylen > sizeof(perfstr)-strlen(perfstr)-1) 236 if (copylen > sizeof(perfstr)-strlen(perfstr)-1)
237 copylen = sizeof(perfstr)-strlen(perfstr)-1; 237 copylen = sizeof(perfstr)-strlen(perfstr)-1;
238 strncat(perfstr, ptr, copylen); 238 ptr2 = ptr;
239 ptr = foo; 239 ptr = foo;
240 240
241 if (ptr == NULL) 241 if (ptr == NULL)
@@ -368,11 +368,15 @@ main (int argc, char **argv)
368 368
369 i++; 369 i++;
370 370
371 strncat(perfstr, "=", sizeof(perfstr)-strlen(perfstr)-1); 371 if (is_numeric(show)) {
372 strncat(perfstr, show, sizeof(perfstr)-strlen(perfstr)-1); 372 strncat(perfstr, ptr2, copylen);
373 if (type) 373 strncat(perfstr, "=", sizeof(perfstr)-strlen(perfstr)-1);
374 strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1); 374 strncat(perfstr, show, sizeof(perfstr)-strlen(perfstr)-1);
375 strncat(perfstr, " ", sizeof(perfstr)-strlen(perfstr)-1); 375
376 if (type)
377 strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1);
378 strncat(perfstr, " ", sizeof(perfstr)-strlen(perfstr)-1);
379 }
376 380
377 } /* end while (ptr) */ 381 } /* end while (ptr) */
378 382