mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Fix assertion failure related to openbsd strtol().
Fixes bug 22789; bugfix on 0.2.3.8-alpha.
This commit is contained in:
+6
-2
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user