]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
WKS: reject records with zero octets at the end of the bitmap
authorMark Andrews <marka@isc.org>
Thu, 13 Aug 2020 03:33:32 +0000 (13:33 +1000)
committerMark Andrews <marka@isc.org>
Thu, 13 Aug 2020 14:26:42 +0000 (00:26 +1000)
(cherry picked from commit 9d446142d89af49cdda65eb98054ae4cae69a0f8)

lib/dns/rdata/in_1/wks_11.c

index 51b16e60af3c2a09c1fb6aeaace0762cd60a4551..e0941fa5f3a16e739032048ea90e2db232f51392 100644 (file)
@@ -250,12 +250,18 @@ fromwire_in_wks(ARGS_FROMWIRE) {
        isc_buffer_activeregion(source, &sr);
        isc_buffer_availableregion(target, &tr);
 
-       if (sr.length < 5)
+       if (sr.length < 5) {
                return (ISC_R_UNEXPECTEDEND);
-       if (sr.length > 8 * 1024 + 5)
+       }
+       if (sr.length > 8 * 1024 + 5) {
                return (DNS_R_EXTRADATA);
-       if (tr.length < sr.length)
+       }
+       if (sr.length > 5 && sr.base[sr.length - 1] == 0) {
+               return (DNS_R_FORMERR);
+       }
+       if (tr.length < sr.length) {
                return (ISC_R_NOSPACE);
+       }
 
        memmove(tr.base, sr.base, sr.length);
        isc_buffer_add(target, sr.length);