[tor-commits] [goptlib/master] Fix TestResolveAddr.

dcf at torproject.org dcf at torproject.org
Mon Dec 9 02:49:51 UTC 2013


commit f78c529302ea34027039336fee08991ebc367ce9
Author: David Fifield <david at bamsoftware.com>
Date:   Sun Dec 8 11:41:35 2013 -0800

    Fix TestResolveAddr.
    
    We try reading the address from the Buffer with a size one greater than
    its expected length, to ensure that it's not too long. But we didn't
    trim that extra byte before trying to resolve it again, so there was an
    extra '\x00' at the end. Previously it was ignored by net.LookupPort.
---
 pt_test.go |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pt_test.go b/pt_test.go
index 653d64d..856b23c 100644
--- a/pt_test.go
+++ b/pt_test.go
@@ -496,7 +496,7 @@ func TestExtOrSendUserAddr(t *testing.T) {
 		}
 		// test that parsing the address gives something equivalent to
 		// the original.
-		outputAddr, err := resolveAddr(string(p))
+		outputAddr, err := resolveAddr(string(p[:n]))
 		if err != nil {
 			t.Fatal(err)
 		}





More information about the tor-commits mailing list