]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Prevent WIRE_INVALID() being called without a argument
authorMark Andrews <marka@isc.org>
Thu, 28 Feb 2019 07:04:02 +0000 (18:04 +1100)
committerMark Andrews <marka@isc.org>
Thu, 11 Apr 2019 09:51:06 +0000 (19:51 +1000)
(cherry picked from commit e73a5b0ce3c5364ab9ac66587be413bfe51080d8)

lib/dns/tests/rdata_test.c

index dbb477209f4502a7080d1ef033797045b02588a0..d5d65604d347c26303270ec08039cf5da92b5439 100644 (file)
@@ -105,7 +105,14 @@ typedef struct wire_ok {
                                        ok                                    \
                                }
 #define WIRE_VALID(...)                WIRE_TEST(true, __VA_ARGS__)
-#define WIRE_INVALID(...)      WIRE_TEST(false, __VA_ARGS__)
+/*
+ * WIRE_INVALID() test cases must always have at least one octet specified to
+ * distinguish them from WIRE_SENTINEL().  Use the 'empty_ok' parameter passed
+ * to check_wire_ok() for indicating whether empty RDATA is allowed for a given
+ * RR type or not.
+ */
+#define WIRE_INVALID(FIRST, ...) \
+                               WIRE_TEST(false, FIRST, __VA_ARGS__)
 #define WIRE_SENTINEL()                WIRE_TEST(false)
 
 /*
@@ -1682,11 +1689,8 @@ eid(void **state) {
                TEXT_SENTINEL()
        };
        wire_ok_t wire_ok[] = {
-               /*
-                * Too short.
-                */
-               WIRE_INVALID(),
                WIRE_VALID(0x00),
+               WIRE_VALID(0xAA, 0xBB, 0xCC),
                /*
                 * Sentinel.
                 */
@@ -1875,11 +1879,8 @@ nimloc(void **state) {
                TEXT_SENTINEL()
        };
        wire_ok_t wire_ok[] = {
-               /*
-                * Too short.
-                */
-               WIRE_INVALID(),
                WIRE_VALID(0x00),
+               WIRE_VALID(0xAA, 0xBB, 0xCC),
                /*
                 * Sentinel.
                 */
@@ -1971,7 +1972,7 @@ nsec(void **state) {
                WIRE_INVALID(0x00, 0x00),
                WIRE_INVALID(0x00, 0x00, 0x00),
                WIRE_VALID(0x00, 0x00, 0x01, 0x02),
-               WIRE_INVALID()
+               WIRE_SENTINEL()
        };
 
        UNUSED(state);