From: Guus Sliepen Date: Mon, 26 Jul 2021 14:03:44 +0000 (+0200) Subject: Fix ASAN warning. X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=commitdiff_plain;h=f144971bf2e13baa80e41188546533f73f3cf453 Fix ASAN warning. The commit fixing the stack overflow for malformed Subnets could compare against a NULL pointer, which works fine in practice but is undefined behavior. --- diff --git a/src/subnet_parse.c b/src/subnet_parse.c index 044d6e72..312e310c 100644 --- a/src/subnet_parse.c +++ b/src/subnet_parse.c @@ -307,7 +307,7 @@ bool str2net(subnet_t *subnet, const char *subnetstr) { char *last_colon = strrchr(str, ':'); /* Check that the last colon is not further than possible in an IPv6 address */ - if(last_colon >= str + 5 * 8) { + if(last_colon && last_colon >= str + 5 * 8) { return false; }