From bcb9ce2498d52214ca4fde9bab8a6b415c350eff Mon Sep 17 00:00:00 2001 From: Max Schaefer Date: Fri, 6 Mar 2020 14:19:10 +0000 Subject: [PATCH] Add another test for StringBreak. --- ql/test/query-tests/Security/CWE-089/tst.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/ql/test/query-tests/Security/CWE-089/tst.go b/ql/test/query-tests/Security/CWE-089/tst.go index af0d7e6cf79..403d29a53e4 100644 --- a/ql/test/query-tests/Security/CWE-089/tst.go +++ b/ql/test/query-tests/Security/CWE-089/tst.go @@ -10,5 +10,19 @@ func marshal(version interface{}) string { if err != nil { return fmt.Sprintf("error: '%v'", err) // OK } - return versionJSON + return string(versionJSON) +} + +type StringWrapper struct { + s string +} + +func marshalUnmarshal(w1 StringWrapper) (string, error) { + buf, err := json.Marshal(w1) + if err != nil { + return "", err + } + var w2 StringWrapper + json.Unmarshal(buf, &w2) + return fmt.Sprintf("wrapped string: '%s'", w2.s), nil // OK }