diff options
author | rl1987 <rl1987@sdf.lonestar.org> | 2018-02-21 20:23:21 +0100 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-03-28 07:39:03 -0400 |
commit | 6b6d003f43cbbf01b40cedb0cc12ada2e81461f9 (patch) | |
tree | 829218907a1870688faad805ede2eb890d82be73 /src/common/util.c | |
parent | d891010fdd4562e29a5a468232cd7b30430d7570 (diff) | |
download | tor-6b6d003f43cbbf01b40cedb0cc12ada2e81461f9.tar.gz tor-6b6d003f43cbbf01b40cedb0cc12ada2e81461f9.zip |
Don't explode on NULL or empty string
Diffstat (limited to 'src/common/util.c')
-rw-r--r-- | src/common/util.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/common/util.c b/src/common/util.c index 1402462fb0..53e117f24c 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -1081,8 +1081,13 @@ string_is_valid_dest(const char *string) int retval; size_t len = strlen(string); - tor_assert(string); - tor_assert(len > 0); + if (string == NULL) + return 0; + + len = strlen(string); + + if (len == 0) + return 0; if (string[0] == '[' && string[len - 1] == ']') string = tmp = tor_strndup(string + 1, len - 2); |