From f144971bf2e13baa80e41188546533f73f3cf453 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Mon, 26 Jul 2021 16:03:44 +0200 Subject: [PATCH] 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. --- src/subnet_parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- 2.20.1