Permalink
Browse files

avoided invalid memory access in RT{USE,REUSE,RELEASE} when 'time_sec…

…ond'

is rewinded.
(KAME PR 439)
  • Loading branch information...
jinmei
jinmei committed Aug 23, 2002
1 parent 4c2449b commit 353dac197d9dd809133a53b103899fa7967a6e4a
Showing with 3 additions and 3 deletions.
  1. +3 −3 freebsd4/sys/net/route.h
View
@@ -330,7 +330,7 @@ struct rttimer_queue {
(rt)->rt_use++; \
(rt)->rt_lastreftime = time_second; \
i = ((rt)->rt_lastreftime - (rt)->rt_createtime) / 300; \
- if (i > 12) \
+ if (i < 0 || i > 12) \
i = 12; \
(rt)->rt_usehist[i]++; \
} while (0)
@@ -339,7 +339,7 @@ struct rttimer_queue {
do { \
int i; \
i = (time_second - (rt)->rt_createtime) / 300; \
- if (i > 12) \
+ if (i < 0 || i > 12) \
i = 12; \
(rt)->rt_reusehist[i]++; \
} while (0)
@@ -348,7 +348,7 @@ struct rttimer_queue {
do { \
int i; \
i = (time_second - (rt)->rt_createtime) / 300; \
- if (i > 12) \
+ if (i < 0 || i > 12) \
i = 12; \
(rt)->rt_releasehist[i]++; \
} while (0)

0 comments on commit 353dac1

Please sign in to comment.