summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2562434)
raw | patch | inline | side by side (parent: 2562434)
author | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | |
Fri, 9 Nov 2007 16:05:48 +0000 (16:05 +0000) | ||
committer | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | |
Fri, 9 Nov 2007 16:05:48 +0000 (16:05 +0000) |
This patch comes from the Gentoo Portage tree but I couldn't find the author. I sent an email and will give credits when I get an answer.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1814 f882894a-f735-0410-b71e-b25c423dba1c
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1814 f882894a-f735-0410-b71e-b25c423dba1c
plugins/check_snmp.c | patch | blob | history |
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 3f9a03d2bcaa30762afcab756df0d1130d1fbace..9fa4a60bf4069bf355c86073ea8127d7ac0ce646 100644 (file)
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
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)
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) */