mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 23:53:32 +01:00
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
This commit is contained in:
parent
a753ef8517
commit
f9ad35c361
@ -304,6 +304,7 @@ test_util_config_line_escaped_content(void)
|
|||||||
char buf2[128];
|
char buf2[128];
|
||||||
char buf3[128];
|
char buf3[128];
|
||||||
char buf4[128];
|
char buf4[128];
|
||||||
|
char buf5[128];
|
||||||
char *k=NULL, *v=NULL;
|
char *k=NULL, *v=NULL;
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
@ -330,6 +331,9 @@ test_util_config_line_escaped_content(void)
|
|||||||
strlcpy(buf4, "BrokenOctal \"\\8\"\n"
|
strlcpy(buf4, "BrokenOctal \"\\8\"\n"
|
||||||
, sizeof(buf4));
|
, sizeof(buf4));
|
||||||
|
|
||||||
|
strlcpy(buf5, "BrokenHex \"\\xg4\"\n"
|
||||||
|
, sizeof(buf5));
|
||||||
|
|
||||||
str = buf1;
|
str = buf1;
|
||||||
|
|
||||||
str = parse_config_line_from_str(str, &k, &v);
|
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);
|
test_eq_ptr(str, NULL);
|
||||||
tor_free(k); tor_free(v);
|
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:
|
done:
|
||||||
tor_free(k);
|
tor_free(k);
|
||||||
tor_free(v);
|
tor_free(v);
|
||||||
|
Loading…
Reference in New Issue
Block a user