]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: dns: remove duplicated code in dns_validate_dns_response()
authorBaptiste Assmann <bassmann@haproxy.com>
Mon, 21 Aug 2017 14:11:32 +0000 (16:11 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 22 Aug 2017 09:40:00 +0000 (11:40 +0200)
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)

src/dns.c

index 82c7329916526ccb068228a671642657868c5edc..421beab2a5807b660623c1bfb2dfd8810cd59b91 100644 (file)
--- 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);