Permalink
Browse files

avoided invalid memory access in some RTxxx macros (see KAME PR 439)

(not sure if the invalid access can really happen, but did it for safety)
  • Loading branch information...
1 parent 353dac1 commit 7466875fd7063e7cde9035897b380774e06cf71a jinmei committed Aug 23, 2002
Showing with 3 additions and 3 deletions.
  1. +3 −3 netbsd/sys/net/route.h
View
@@ -314,7 +314,7 @@ do { \
(rt)->rt_use++; \
(rt)->rt_lastreftime = time.tv_sec; \
i = ((rt)->rt_lastreftime - (rt)->rt_createtime) / 300; \
- if (i > 12) \
+ if (i < 0 || i > 12) \
i = 12; \
(rt)->rt_usehist[i]++; \
} while (0)
@@ -323,7 +323,7 @@ do { \
do { \
int i; \
i = (time.tv_sec - (rt)->rt_createtime) / 300; \
- if (i > 12) \
+ if (i < 0 || i > 12) \
i = 12; \
(rt)->rt_reusehist[i]++; \
} while (0)
@@ -332,7 +332,7 @@ do { \
do { \
int i; \
i = (time.tv_sec - (rt)->rt_createtime) / 300; \
- if (i > 12) \
+ if (i < 0 || i > 12) \
i = 12; \
(rt)->rt_releasehist[i]++; \
} while (0)

0 comments on commit 7466875

Please sign in to comment.