[tor-commits] [tor/release-0.2.2] Don't use signed 1-bit bitfields

arma at torproject.org arma at torproject.org
Mon Jun 20 01:04:13 UTC 2011


commit 680646e0de29454f92d57bc3a4895d75c95e158c
Author: Sebastian Hahn <sebastian at torproject.org>
Date:   Wed Jun 8 21:27:32 2011 +0200

    Don't use signed 1-bit bitfields
    
    This was harmless, we never compared it to anything but itself or 0.
    But Coverity complained, and it had a point.
---
 changes/coverity_maint |    1 +
 src/or/policies.c      |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/changes/coverity_maint b/changes/coverity_maint
index fd8c440..6d60355 100644
--- a/changes/coverity_maint
+++ b/changes/coverity_maint
@@ -4,4 +4,5 @@
   o Minor bugfixes:
     - Add some forgotten return value checks during unit tests. Found
       by coverity.
+    - Don't use 1-bit wide signed bit fields. Found by coverity.
 
diff --git a/src/or/policies.c b/src/or/policies.c
index e48f420..c870360 100644
--- a/src/or/policies.c
+++ b/src/or/policies.c
@@ -45,7 +45,7 @@ typedef struct policy_summary_item_t {
     uint16_t prt_max; /**< Highest port number to accept/reject. */
     uint64_t reject_count; /**< Number of IP-Addresses that are rejected to
                                 this port range. */
-    int accepted:1; /** Has this port already been accepted */
+    unsigned int accepted:1; /** Has this port already been accepted */
 } policy_summary_item_t;
 
 /** Private networks.  This list is used in two places, once to expand the





More information about the tor-commits mailing list