summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-07-05 13:41:27 -0400
committerNick Mathewson <nickm@torproject.org>2017-07-05 13:41:27 -0400
commit0ee15c92d5486fc73ba49dea7f12bf2f89012cfb (patch)
tree929eb2a05c3523bf4f3b5ba61c2918543e0e3764 /src/common
parentd56f6993990ab75b6ab8a80027ee60e610489a2c (diff)
parentbb3f74e66bd9df94ce9d1949164348efac728ea9 (diff)
downloadtor-0ee15c92d5486fc73ba49dea7f12bf2f89012cfb.tar.gz
tor-0ee15c92d5486fc73ba49dea7f12bf2f89012cfb.zip
Merge branch 'bug22789_024' into maint-0.2.4
Diffstat (limited to 'src/common')
-rw-r--r--src/common/compat.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/common/compat.c b/src/common/compat.c
index d88c5f92de..b77f25b467 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -2045,8 +2045,12 @@ tor_inet_pton(int af, const char *src, void *dst)
char *next;
ssize_t len;
long r = strtol(src, &next, 16);
- tor_assert(next != NULL);
- tor_assert(next != src);
+ if (next == NULL || next == src) {
+ /* The 'next == src' error case can happen on versions of openbsd
+ * where treats "0xfoo" as an error, rather than as "0" followed by
+ * "xfoo". */
+ return 0;
+ }
len = *next == '\0' ? eow - src : next - src;
if (len > 4)