aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHiroki Sato <hrs@FreeBSD.org>2012-03-02 00:15:52 +0000
committerHiroki Sato <hrs@FreeBSD.org>2012-03-02 00:15:52 +0000
commitd48399e1549b481fd7b590a7c7756c5e3df9b283 (patch)
tree588409bf06bbe96c193ee79512bc729bc26929b1
parent9671118b19e8ce48b6dbd974e358aaea22bbee8f (diff)
downloadsrc-d48399e1549b481fd7b590a7c7756c5e3df9b283.tar.gz
src-d48399e1549b481fd7b590a7c7756c5e3df9b283.zip
MFC r230989: Fix a possible infinite loop in "route flush" on 64-bit archs.
Approved by: re (bz)
Notes
Notes: svn path=/stable/8/; revision=232371
-rw-r--r--sbin/route/route.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sbin/route/route.c b/sbin/route/route.c
index 4b2f16ea73b6..717a09ad2a8b 100644
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -460,8 +460,8 @@ netname(struct sockaddr *sa)
* Guess at the subnet mask, assuming reasonable
* width subnet fields.
*/
- while (in.s_addr &~ mask)
- mask = (long)mask >> subnetshift;
+ while (in.s_addr & ~mask)
+ mask |= mask >> subnetshift;
net = in.s_addr & mask;
while ((mask & 1) == 0)
mask >>= 1, net >>= 1;