mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-05 21:11:53 +00:00
BUG/MINOR: listener: fix off-by-one in state name check
As reported in issue #380, the state check in listener_state_str() is invalid as it allows state value 9 to report crap. We don't use such a state value so the issue should never happen unless the memory is already corrupted, but better clean this now while it's harmless. This should be backported to all maintained branches.
This commit is contained in:
parent
2444108f16
commit
fec56c6a76
@ -176,7 +176,7 @@ static inline const char *listener_state_str(const struct listener *l)
|
||||
};
|
||||
unsigned int st = l->state;
|
||||
|
||||
if (st > sizeof(states) / sizeof(*states))
|
||||
if (st >= sizeof(states) / sizeof(*states))
|
||||
return "INVALID";
|
||||
return states[st];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user