mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-23 20:03:31 +01:00
Fix a possible negative shift in address comparison. May fix bug 845 and bug 811
svn:r17169
This commit is contained in:
parent
accb4a680f
commit
361086005c
@ -41,6 +41,8 @@ Changes in version 0.2.1.7-alpha - 2008-10-xx
|
||||
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
|
||||
|
@ -686,6 +686,8 @@ tor_addr_compare_masked(const tor_addr_t *addr1, const tor_addr_t *addr2,
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user