diff options
author | phk <phk@FreeBSD.org> | 2003-05-31 18:54:02 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-05-31 18:54:02 +0000 |
commit | 86f75c18a65310b3b7e43cb1a8a05136b89a558b (patch) | |
tree | 1c704a5eefdd03fa909a3c53d53f70f72783e77f /sys/i4b | |
parent | 4c5b260ddcb0f048ba772ce14ca98197ce8e0255 (diff) | |
download | FreeBSD-src-86f75c18a65310b3b7e43cb1a8a05136b89a558b.zip FreeBSD-src-86f75c18a65310b3b7e43cb1a8a05136b89a558b.tar.gz |
Fix off-by-one errors in range checks of state machine states & events.
Found by: FlexeLint
Diffstat (limited to 'sys/i4b')
-rw-r--r-- | sys/i4b/layer2/i4b_l2fsm.c | 8 | ||||
-rw-r--r-- | sys/i4b/layer3/i4b_l3fsm.c | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/sys/i4b/layer2/i4b_l2fsm.c b/sys/i4b/layer2/i4b_l2fsm.c index c4df653..02c9920 100644 --- a/sys/i4b/layer2/i4b_l2fsm.c +++ b/sys/i4b/layer2/i4b_l2fsm.c @@ -230,12 +230,12 @@ void i4b_next_l2state(l2_softc_t *l2sc, int event) panic("i4b_l2fsm.c: event >= N_EVENTS\n"); /* get current state and check it */ - if((currstate = l2sc->Q921_state) > N_STATES) /* failsafe */ - panic("i4b_l2fsm.c: currstate > N_STATES\n"); + if((currstate = l2sc->Q921_state) >= N_STATES) /* failsafe */ + panic("i4b_l2fsm.c: currstate >= N_STATES\n"); /* get new state and check it */ - if((newstate = l2state_tab[event][currstate].newstate) > N_STATES) - panic("i4b_l2fsm.c: newstate > N_STATES\n"); + if((newstate = l2state_tab[event][currstate].newstate) >= N_STATES) + panic("i4b_l2fsm.c: newstate >= N_STATES\n"); if(newstate != ST_SUBSET) diff --git a/sys/i4b/layer3/i4b_l3fsm.c b/sys/i4b/layer3/i4b_l3fsm.c index 11b97e8..3364467 100644 --- a/sys/i4b/layer3/i4b_l3fsm.c +++ b/sys/i4b/layer3/i4b_l3fsm.c @@ -211,13 +211,13 @@ void next_l3state(call_desc_t *cd, int event) { int currstate, newstate; - if(event > N_EVENTS) - panic("i4b_l3fsm.c: event > N_EVENTS\n"); + if(event >= N_EVENTS) + panic("i4b_l3fsm.c: event >= N_EVENTS\n"); currstate = cd->Q931state; - if(currstate > N_STATES) - panic("i4b_l3fsm.c: currstate > N_STATES\n"); + if(currstate >= N_STATES) + panic("i4b_l3fsm.c: currstate >= N_STATES\n"); newstate = l3state_tab[event][currstate].newstate; |