aboutsummaryrefslogtreecommitdiffstats
path: root/net-mgmt/nagios4/files/patch-d97e03f32741a7d851826b03ed73ff4c9612a866
blob: 899807abf97836dca2e472c67fb0884222bbae49 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
commit d97e03f32741a7d851826b03ed73ff4c9612a866
Author: Eric Stanley <estanley@nagios.com>
Date:   2013-12-20 13:14:30 -0600

    CGIs: Fixed minor vulnerability where a custom query could crash the CGI.
    
    Most CGIs previously incremented the input variable counter twice when
    it encountered a long key value. This could cause the CGI to read past
    the end of the list of CGI variables. This commit removes the second
    increment, removing the possibility of reading past the end of the list
    of CGI variables.

diff --git ./cgi/avail.c ./cgi/avail.c
index 76afd86..64eaadc 100644
--- ./cgi/avail.c
+++ ./cgi/avail.c
@@ -1096,7 +1096,6 @@ int process_cgivars(void) {
 
        /* do some basic length checking on the variable identifier to prevent buffer overflows */
        if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
-           x++;
            continue;
            }
 
diff --git ./cgi/cmd.c ./cgi/cmd.c
index fa6cf5a..50504eb 100644
--- ./cgi/cmd.c
+++ ./cgi/cmd.c
@@ -311,7 +311,6 @@ int process_cgivars(void) {
 
        /* do some basic length checking on the variable identifier to prevent buffer overflows */
        if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
-           x++;
            continue;
            }
 
diff --git ./cgi/config.c ./cgi/config.c
index f061b0f..3360e70 100644
--- ./cgi/config.c
+++ ./cgi/config.c
@@ -344,7 +344,6 @@ int process_cgivars(void) {
 
        /* do some basic length checking on the variable identifier to prevent buffer overflows */
        if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
-           x++;
            continue;
            }
 
diff --git ./cgi/extinfo.c ./cgi/extinfo.c
index 62a1b18..5113df4 100644
--- ./cgi/extinfo.c
+++ ./cgi/extinfo.c
@@ -591,7 +591,6 @@ int process_cgivars(void) {
 
        /* do some basic length checking on the variable identifier to prevent buffer overflows */
        if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
-           x++;
            continue;
            }
 
diff --git ./cgi/histogram.c ./cgi/histogram.c
index 4616541..f6934d0 100644
--- ./cgi/histogram.c
+++ ./cgi/histogram.c
@@ -1060,7 +1060,6 @@ int process_cgivars(void) {
 
        /* do some basic length checking on the variable identifier to prevent buffer overflows */
        if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
-           x++;
            continue;
            }
 
diff --git ./cgi/notifications.c ./cgi/notifications.c
index 8ba11c1..461ae84 100644
--- ./cgi/notifications.c
+++ ./cgi/notifications.c
@@ -327,7 +327,6 @@ int process_cgivars(void) {
 
        /* do some basic length checking on the variable identifier to prevent buffer overflows */
        if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
-           x++;
            continue;
            }
 
diff --git ./cgi/outages.c ./cgi/outages.c
index 426ede6..cb58dee 100644
--- ./cgi/outages.c
+++ ./cgi/outages.c
@@ -225,7 +225,6 @@ int process_cgivars(void) {
 
        /* do some basic length checking on the variable identifier to prevent buffer overflows */
        if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
-           x++;
            continue;
            }
 
diff --git ./cgi/status.c ./cgi/status.c
index 3253340..4ec1c92 100644
--- ./cgi/status.c
+++ ./cgi/status.c
@@ -567,7 +567,6 @@ int process_cgivars(void) {
 
        /* do some basic length checking on the variable identifier to prevent buffer overflows */
        if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
-           x++;
            continue;
            }
 
diff --git ./cgi/statusmap.c ./cgi/statusmap.c
index ea48368..2580ae5 100644
--- ./cgi/statusmap.c
+++ ./cgi/statusmap.c
@@ -400,7 +400,6 @@ int process_cgivars(void) {
 
        /* do some basic length checking on the variable identifier to prevent buffer overflows */
        if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
-           x++;
            continue;
            }
 
diff --git ./cgi/statuswml.c ./cgi/statuswml.c
index bd8cea2..d25abef 100644
--- ./cgi/statuswml.c
+++ ./cgi/statuswml.c
@@ -226,8 +226,13 @@ int process_cgivars(void) {
 
    for(x = 0; variables[x] != NULL; x++) {
 
+       /* do some basic length checking on the variable identifier to prevent buffer overflows */
+       if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
+           continue;
+           }
+
        /* we found the hostgroup argument */
-       if(!strcmp(variables[x], "hostgroup")) {
+       else if(!strcmp(variables[x], "hostgroup")) {
            display_type = DISPLAY_HOSTGROUP;
            x++;
            if(variables[x] == NULL) {
diff --git ./cgi/summary.c ./cgi/summary.c
index 126ce5e..749a02c 100644
--- ./cgi/summary.c
+++ ./cgi/summary.c
@@ -725,7 +725,6 @@ int process_cgivars(void) {
 
        /* do some basic length checking on the variable identifier to prevent buffer overflows */
        if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
-           x++;
            continue;
            }
 
diff --git ./cgi/trends.c ./cgi/trends.c
index b35c18e..895db01 100644
--- ./cgi/trends.c
+++ ./cgi/trends.c
@@ -1263,7 +1263,6 @@ int process_cgivars(void) {
 
        /* do some basic length checking on the variable identifier to prevent buffer overflows */
        if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
-           x++;
            continue;
            }
 
diff --git ./contrib/daemonchk.c ./contrib/daemonchk.c
index 78716e5..9bb6c4b 100644
--- ./contrib/daemonchk.c
+++ ./contrib/daemonchk.c
@@ -174,7 +174,6 @@ static int process_cgivars(void) {
 
        /* do some basic length checking on the variable identifier to prevent buffer overflows */
        if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
-           x++;
            continue;
            }
        }