aboutsummaryrefslogtreecommitdiff
path: root/contrib/ntp/sntp/tests/packetHandling.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ntp/sntp/tests/packetHandling.c')
-rw-r--r--contrib/ntp/sntp/tests/packetHandling.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/contrib/ntp/sntp/tests/packetHandling.c b/contrib/ntp/sntp/tests/packetHandling.c
index 595efa3b129a..6787eeaa2fe9 100644
--- a/contrib/ntp/sntp/tests/packetHandling.c
+++ b/contrib/ntp/sntp/tests/packetHandling.c
@@ -84,7 +84,8 @@ test_GenerateAuthenticatedPacket(void)
testkey.key_id = 30;
testkey.key_len = 9;
memcpy(testkey.key_seq, "123456789", testkey.key_len);
- memcpy(testkey.type, "MD5", 3);
+ strlcpy(testkey.typen, "MD5", sizeof(testkey.typen));
+ testkey.typei = keytype_from_text(testkey.typen, NULL);
GETTIMEOFDAY(&xmt, NULL);
xmt.tv_sec += JAN_1970;
@@ -106,7 +107,7 @@ test_GenerateAuthenticatedPacket(void)
TEST_ASSERT_EQUAL(testkey.key_id, ntohl(testpkt.exten[0]));
TEST_ASSERT_EQUAL(MAX_MD5_LEN - 4, /* Remove the key_id, only keep the mac. */
- make_mac(&testpkt, LEN_PKT_NOMAC, MAX_MD5_LEN, &testkey, expected_mac));
+ make_mac(&testpkt, LEN_PKT_NOMAC, MAX_MD5_LEN-4, &testkey, expected_mac));
TEST_ASSERT_EQUAL_MEMORY(expected_mac, (char*)&testpkt.exten[1], MAX_MD5_LEN -4);
}