From f9ad35c361b4c183a55dec3f9fa7eb728e089730 Mon Sep 17 00:00:00 2001 From: Esteban Manchado Velázquez Date: Fri, 3 Feb 2012 23:28:40 +0100 Subject: Add test for broken hex parsing * The test currently fails, but it's commented out (with an "#if 0") * As a broken octal actually gives a parse error, it seems fair that this fails, too --- src/test/test_util.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/test') diff --git a/src/test/test_util.c b/src/test/test_util.c index b8c0544c3f..4bcd49f549 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -304,6 +304,7 @@ test_util_config_line_escaped_content(void) char buf2[128]; char buf3[128]; char buf4[128]; + char buf5[128]; char *k=NULL, *v=NULL; const char *str; @@ -330,6 +331,9 @@ test_util_config_line_escaped_content(void) strlcpy(buf4, "BrokenOctal \"\\8\"\n" , sizeof(buf4)); + strlcpy(buf5, "BrokenHex \"\\xg4\"\n" + , sizeof(buf5)); + str = buf1; str = parse_config_line_from_str(str, &k, &v); @@ -405,6 +409,14 @@ test_util_config_line_escaped_content(void) test_eq_ptr(str, NULL); tor_free(k); tor_free(v); +#if 0 + str = buf5; + + str = parse_config_line_from_str(str, &k, &v); + test_eq_ptr(str, NULL); + tor_free(k); tor_free(v); +#endif + done: tor_free(k); tor_free(v); -- cgit v1.2.3-54-g00ecf