aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-03-18 10:49:39 -0400
committerNick Mathewson <nickm@torproject.org>2014-03-18 10:49:39 -0400
commitdfdeb6418d3d99e6e9099a3ad8ca83c206b52bdc (patch)
treeb870ec4aa66ebfdde6e0077b78b58323ccbcd076 /src/common
parent2aea6ca3260cee82a60168c047f4d0cc71f7c652 (diff)
downloadtor-dfdeb6418d3d99e6e9099a3ad8ca83c206b52bdc.tar
tor-dfdeb6418d3d99e6e9099a3ad8ca83c206b52bdc.tar.gz
Fix a ubsan warning in addr_mask_get_bits
ubsan doesn't like us to do (1u<<32) when 32 is wider than unsigned. Fortunately, we already special-case addr_mask_get_bits(0), so we can just change the loop bounds.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/address.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/common/address.c b/src/common/address.c
index 69049fa0a..bb1a24419 100644
--- a/src/common/address.c
+++ b/src/common/address.c
@@ -1585,7 +1585,7 @@ addr_mask_get_bits(uint32_t mask)
return 0;
if (mask == 0xFFFFFFFFu)
return 32;
- for (i=0; i<=32; ++i) {
+ for (i=1; i<=32; ++i) {
if (mask == (uint32_t) ~((1u<<(32-i))-1)) {
return i;
}