[tor-commits] [tor/master] Fix a pointer size error in test_bridges.c

nickm at torproject.org nickm at torproject.org
Tue Apr 17 23:46:34 UTC 2018


commit 3bf9974b6c4ee9f2a8204c058e1b7c206b99d620
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue Apr 17 19:44:09 2018 -0400

    Fix a pointer size error in test_bridges.c
    
    sizeof(ret) is the size of the pointer, not the size of what it
    points to.  Fortunately, we already have a function to compare
    tor_addr_port_t values for equality.
    
    Bugfix on c2c5b13e5d8a77e; bug not in any released Tor. Found by
    clang's scan-build.
---
 src/test/test_bridges.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/test_bridges.c b/src/test/test_bridges.c
index b5bd27e09..c4a4cacd9 100644
--- a/src/test/test_bridges.c
+++ b/src/test/test_bridges.c
@@ -234,7 +234,7 @@ test_bridges_get_configured_bridge_by_orports_digest(void *arg)
   ret = get_configured_bridge_by_orports_digest(digest, orports);
   tt_ptr_op(ret, OP_NE, NULL);
 
-  tt_mem_op(addrport1, OP_EQ, bridge_get_addr_port(ret), sizeof(ret));
+  tt_assert(tor_addr_port_eq(addrport1, bridge_get_addr_port(ret)));
 
  done:
   smartlist_free(orports);



More information about the tor-commits mailing list