From 4e5248ebf370372e63a624ae5897d2e287d657bb Mon Sep 17 00:00:00 2001 From: Nick Peng Date: Sat, 9 Jan 2021 12:19:07 +0800 Subject: [PATCH] BugFix: Fix issue #670, Contributed by Enna1 --- src/dns.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dns.c b/src/dns.c index 0e43992..83b15dc 100644 --- a/src/dns.c +++ b/src/dns.c @@ -1363,7 +1363,7 @@ static int _dns_decode_opt_ecs(struct dns_context *context, struct dns_opt_ecs * len = (ecs->source_prefix / 8); len += (ecs->source_prefix % 8 > 0) ? 1 : 0; - if (_dns_left_len(context) < len) { + if (_dns_left_len(context) < len || len > sizeof(ecs->addr)) { return -1; }