[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit f78c529302ea34027039336fee08991ebc367ce9
Author: David Fifield <david@xxxxxxxxxxxxxxx>
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)
 		}



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits