summaryrefslogtreecommitdiff
path: root/src/common/compat.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-07-05 13:43:31 -0400
committerNick Mathewson <nickm@torproject.org>2017-07-05 13:43:31 -0400
commit546f5b364bd8198b23b1ad4e66790eb1ce9b438e (patch)
tree7e763a2d2c3a68ffaba52568ea25d7c60951855b /src/common/compat.c
parent8bc70a2ad2c0363986e4b002ceaf259908d67e70 (diff)
parent32c0066e4baa2ca16902a70b941d8d3afbc279ff (diff)
downloadtor-546f5b364bd8198b23b1ad4e66790eb1ce9b438e.tar.gz
tor-546f5b364bd8198b23b1ad4e66790eb1ce9b438e.zip
Merge branch 'maint-0.2.9' into maint-0.3.0
Diffstat (limited to 'src/common/compat.c')
-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 0dbede6bed..4b8b73b4fc 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -2593,8 +2593,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)