commit 1f47c1e30389fbf9e14d29deac1abcb30617d9ec
Author: David Fifield <da...@bamsoftware.com>
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@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits

Reply via email to