From: Baptiste Assmann Date: Mon, 21 Aug 2017 14:11:32 +0000 (+0200) Subject: CLEANUP: dns: remove duplicated code in dns_validate_dns_response() X-Git-Tag: v1.8-dev3~160 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8d112362343dfc7848b3838fe070358b38002afa;p=thirdparty%2Fhaproxy.git CLEANUP: dns: remove duplicated code in dns_validate_dns_response() a reader pointer comparison to the end of the buffer was performed twice while once is obviously enough. backport status: this patch can be backported into HAProxy 1.6 (with some modification. Please contact me) --- diff --git a/src/dns.c b/src/dns.c index 82c7329916..421beab2a5 100644 --- a/src/dns.c +++ b/src/dns.c @@ -1239,11 +1239,6 @@ int dns_validate_dns_response(unsigned char *resp, unsigned char *bufend, struct return DNS_RESP_INVALID; } - if (reader >= bufend) { - free_dns_answer_item(dns_answer_record); - return DNS_RESP_INVALID; - } - /* 2 bytes for record type (A, AAAA, CNAME, etc...) */ if (reader + 2 > bufend) { free_dns_answer_item(dns_answer_record);