]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2275] valgrind fix: initialize memory in labelsequence test
authorJelte Jansen <jelte@isc.org>
Wed, 3 Oct 2012 14:54:08 +0000 (16:54 +0200)
committerJINMEI Tatuya <jinmei@isc.org>
Thu, 11 Oct 2012 17:04:26 +0000 (10:04 -0700)
src/lib/dns/tests/labelsequence_unittest.cc

index 90d470d256bb3092492179798e9040040f20189a..fec1c799c741a6eceb5181821ab1a3bd5cb3f794 100644 (file)
@@ -861,7 +861,11 @@ TEST_F(LabelSequenceTest, badDeserialize) {
     EXPECT_THROW(LabelSequence ls(toomany_offsets), isc::BadValue);
 
     // exceed MAX_LABEL_LEN
-    const uint8_t offsets_toolonglabel[] = { 2, 0, 64 };
+    uint8_t offsets_toolonglabel[LabelSequence::MAX_SERIALIZED_LENGTH];
+    memset(&offsets_toolonglabel, 0, LabelSequence::MAX_SERIALIZED_LENGTH);
+    offsets_toolonglabel[0] = 2;
+    offsets_toolonglabel[1] = 0;
+    offsets_toolonglabel[2] = 64;
     EXPECT_THROW(LabelSequence ls(offsets_toolonglabel), isc::BadValue);
 
     // Inconsistent data: an offset is lower than the previous offset