mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 23:53:32 +01:00
Add test for broken escapes in parse_config_...
This commit is contained in:
parent
8bb68011f0
commit
fa4ca5ddc1
@ -415,6 +415,7 @@ test_util_config_line_escaped_content(void)
|
|||||||
char buf3[128];
|
char buf3[128];
|
||||||
char buf4[128];
|
char buf4[128];
|
||||||
char buf5[128];
|
char buf5[128];
|
||||||
|
char buf6[128];
|
||||||
char *k=NULL, *v=NULL;
|
char *k=NULL, *v=NULL;
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
@ -444,6 +445,9 @@ test_util_config_line_escaped_content(void)
|
|||||||
strlcpy(buf5, "BrokenHex \"\\xg4\"\n"
|
strlcpy(buf5, "BrokenHex \"\\xg4\"\n"
|
||||||
, sizeof(buf5));
|
, sizeof(buf5));
|
||||||
|
|
||||||
|
strlcpy(buf6, "BrokenEscape \"\\"
|
||||||
|
, sizeof(buf6));
|
||||||
|
|
||||||
str = buf1;
|
str = buf1;
|
||||||
|
|
||||||
str = parse_config_line_from_str(str, &k, &v);
|
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);
|
tor_free(k); tor_free(v);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
str = buf6;
|
||||||
|
|
||||||
|
str = parse_config_line_from_str(str, &k, &v);
|
||||||
|
test_eq_ptr(str, NULL);
|
||||||
|
tor_free(k); tor_free(v);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
tor_free(k);
|
tor_free(k);
|
||||||
tor_free(v);
|
tor_free(v);
|
||||||
|
Loading…
Reference in New Issue
Block a user