diff options
author | Esteban Manchado Velázquez <emanchado@demiurgo.org> | 2012-02-20 17:39:43 +0100 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-03-08 21:16:45 -0500 |
commit | fa4ca5ddc1f69911fa2dab08cf6d9ea6273daae3 (patch) | |
tree | 08fddc218a71406cad6197a478281812cc207758 | |
parent | 8bb68011f082f12d50ddfbaee354448bfbb6e227 (diff) | |
download | tor-fa4ca5ddc1f69911fa2dab08cf6d9ea6273daae3.tar tor-fa4ca5ddc1f69911fa2dab08cf6d9ea6273daae3.tar.gz |
Add test for broken escapes in parse_config_...
-rw-r--r-- | src/test/test_util.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c index 714b3bdaf..7625e2f5d 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -415,6 +415,7 @@ test_util_config_line_escaped_content(void) char buf3[128]; char buf4[128]; char buf5[128]; + char buf6[128]; char *k=NULL, *v=NULL; const char *str; @@ -444,6 +445,9 @@ test_util_config_line_escaped_content(void) strlcpy(buf5, "BrokenHex \"\\xg4\"\n" , sizeof(buf5)); + strlcpy(buf6, "BrokenEscape \"\\" + , sizeof(buf6)); + str = buf1; str = parse_config_line_from_str(str, &k, &v); @@ -527,6 +531,12 @@ test_util_config_line_escaped_content(void) tor_free(k); tor_free(v); #endif + str = buf6; + + str = parse_config_line_from_str(str, &k, &v); + test_eq_ptr(str, NULL); + tor_free(k); tor_free(v); + done: tor_free(k); tor_free(v); |