]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add test for broken hex parsing
authorEsteban Manchado Velázquez <emanchado@demiurgo.org>
Fri, 3 Feb 2012 22:28:40 +0000 (23:28 +0100)
committerNick Mathewson <nickm@torproject.org>
Fri, 9 Mar 2012 01:49:17 +0000 (20:49 -0500)
* 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

index b8c0544c3fd393f8fde3ad9d5592a6e5e8dad484..4bcd49f549ead56d4f7cca60468e98bd5a692a03 100644 (file)
@@ -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);