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

[tor-commits] [goptlib/master] Test that escape doesn't modify strings without NL and '\x00'.



commit 1f47c1e30389fbf9e14d29deac1abcb30617d9ec
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Wed Oct 8 14:44:35 2014 -0700

    Test that escape doesn't modify strings without NL and '\x00'.
    
    The problem here is double-escaping of backslashes, because backslash is
    used to escape SMETHOD ARGS, and the escape function is escaping them
    again.
    
    https://trac.torproject.org/projects/tor/ticket/12930#comment:3
---
 pt_test.go |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pt_test.go b/pt_test.go
index f104cb0..456313a 100644
--- a/pt_test.go
+++ b/pt_test.go
@@ -35,8 +35,11 @@ func TestEscape(t *testing.T) {
 
 	check := func(input string) {
 		output := escape(input)
+		if stringIsSafe(input) && input != output {
+			t.Errorf("escape(%q) â?? %q despite being safe", input, output)
+		}
 		if !stringIsSafe(output) {
-			t.Errorf("escape(%q) â?? %q", input, output)
+			t.Errorf("escape(%q) â?? %q is not safe", input, output)
 		}
 	}
 	for _, input := range tests {



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