[or-cvs] r17169: {tor} Fix a possible negative shift in address comparison. May fix (in tor/trunk: . src/common)
nickm at seul.org
nickm at seul.org
Wed Oct 29 13:29:54 UTC 2008
Author: nickm
Date: 2008-10-29 09:29:54 -0400 (Wed, 29 Oct 2008)
New Revision: 17169
Modified:
tor/trunk/ChangeLog
tor/trunk/src/common/address.c
Log:
Fix a possible negative shift in address comparison. May fix bug 845 and bug 811
Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog 2008-10-28 17:43:55 UTC (rev 17168)
+++ tor/trunk/ChangeLog 2008-10-29 13:29:54 UTC (rev 17169)
@@ -41,6 +41,8 @@
prevent possible guess-the-streamid injection attacks from
intermediate hops. Fixes another case of bug 446. Based on patch
from rovv.
+ - Avoid using a negative right-shift when comparing 32-bit
+ addresses. Possible fix for bug 845 and bug 811.
Changes in version 0.2.1.6-alpha - 2008-09-30
Modified: tor/trunk/src/common/address.c
===================================================================
--- tor/trunk/src/common/address.c 2008-10-28 17:43:55 UTC (rev 17168)
+++ tor/trunk/src/common/address.c 2008-10-29 13:29:54 UTC (rev 17169)
@@ -686,6 +686,8 @@
case AF_INET: {
uint32_t a1 = ntohl(addr1->addr.in_addr.s_addr);
uint32_t a2 = ntohl(addr2->addr.in_addr.s_addr);
+ if (mbits > 32)
+ mbits = 32;
a1 >>= (32-mbits);
a2 >>= (32-mbits);
return (a1 < a2) ? -1 : (a1 == a2) ? 0 : 1;
More information about the tor-commits
mailing list