]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: checks: ensure the health_status is always within bounds
authorWilly Tarreau <w@1wt.eu>
Wed, 23 Jan 2013 23:37:39 +0000 (00:37 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 24 Jan 2013 15:19:18 +0000 (16:19 +0100)
health_adjust() checks for incorrect bounds for the status argument.
With current code, the argument is always a constant from the valid
enum so there is no impact and the check is basically a NOP. However
users running local patches (eg: new checks) might want to recheck
their code.

This fix should be backported to 1.4 which introduced the issue.

Reported-by: Dinko Korunic <dkorunic@reflected.net>
src/checks.c

index 6d527a328c2f91dbc3afcfc1fde139dd1e6f9418..a933bba65fa8b90d4269b1f5effd8362c2193ba9 100644 (file)
@@ -619,7 +619,7 @@ void health_adjust(struct server *s, short status)
        if (s->observe >= HANA_OBS_SIZE)
                return;
 
-       if (status >= HCHK_STATUS_SIZE || !analyze_statuses[status].desc)
+       if (status >= HANA_STATUS_SIZE || !analyze_statuses[status].desc)
                return;
 
        switch (analyze_statuses[status].lr[s->observe - 1]) {