BugFix: Fix issue #670, Contributed by Enna1

This commit is contained in:
Nick Peng
2021-01-09 12:19:07 +08:00
parent ccd0f203fb
commit 4e5248ebf3

View File

@@ -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;
}