diff options
Diffstat (limited to 'web/attachments/250217-nagiosplugins-checksnmp-crash.patch')
-rw-r--r-- | web/attachments/250217-nagiosplugins-checksnmp-crash.patch | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/web/attachments/250217-nagiosplugins-checksnmp-crash.patch b/web/attachments/250217-nagiosplugins-checksnmp-crash.patch new file mode 100644 index 0000000..6fc9540 --- /dev/null +++ b/web/attachments/250217-nagiosplugins-checksnmp-crash.patch | |||
@@ -0,0 +1,37 @@ | |||
1 | --- plugins/check_snmp.c.old 2007-05-29 07:22:32.000000000 +0200 | ||
2 | +++ plugins/check_snmp.c 2007-10-17 22:08:49.000000000 +0200 | ||
3 | @@ -219,12 +219,16 @@ main (int argc, char **argv) | ||
4 | |||
5 | ptr = output; | ||
6 | |||
7 | - strcat(perfstr, "| "); | ||
8 | + strncat(perfstr, "| ", sizeof(perfstr)-strlen(perfstr)-1); | ||
9 | while (ptr) { | ||
10 | char *foo; | ||
11 | + unsigned int copylen; | ||
12 | |||
13 | foo = strstr (ptr, delimiter); | ||
14 | - strncat(perfstr, ptr, foo-ptr); | ||
15 | + copylen = foo-ptr; | ||
16 | + if (copylen > sizeof(perfstr)-strlen(perfstr)-1) | ||
17 | + copylen = sizeof(perfstr)-strlen(perfstr)-1; | ||
18 | + strncat(perfstr, ptr, copylen); | ||
19 | ptr = foo; | ||
20 | |||
21 | if (ptr == NULL) | ||
22 | @@ -357,11 +361,11 @@ main (int argc, char **argv) | ||
23 | |||
24 | i++; | ||
25 | |||
26 | - strcat(perfstr, "="); | ||
27 | - strcat(perfstr, show); | ||
28 | + strncat(perfstr, "=", sizeof(perfstr)-strlen(perfstr)-1); | ||
29 | + strncat(perfstr, show, sizeof(perfstr)-strlen(perfstr)-1); | ||
30 | if (type) | ||
31 | - strcat(perfstr, type); | ||
32 | - strcat(perfstr, " "); | ||
33 | + strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1); | ||
34 | + strncat(perfstr, " ", sizeof(perfstr)-strlen(perfstr)-1); | ||
35 | |||
36 | } /* end while (ptr) */ | ||
37 | |||