]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
nts: zero cookie placeholder
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 26 Mar 2020 14:30:28 +0000 (15:30 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 26 Mar 2020 14:30:34 +0000 (15:30 +0100)
Zero the body of the cookie placeholder in client requests as
recommended by the latest NTS draft.

nts_ntp_client.c

index 1e23f77c7338010e6975ac384b8c5e0e5221c95a..79d552f8ebd56601189db9ff2542b3e3b0eaa732 100644 (file)
@@ -288,6 +288,7 @@ NNC_GenerateRequestAuth(NNC_Instance inst, NTP_Packet *packet,
 {
   NKE_Cookie *cookie;
   int i, req_cookies;
+  void *ef_body;
 
   if (inst->num_cookies == 0 || !inst->siv_c2s)
     return 0;
@@ -308,9 +309,10 @@ NNC_GenerateRequestAuth(NNC_Instance inst, NTP_Packet *packet,
     return 0;
 
   for (i = 0; i < req_cookies - 1; i++) {
-    if (!NEF_AddField(packet, info, NTP_EF_NTS_COOKIE_PLACEHOLDER,
-                      cookie->cookie, cookie->length))
+    if (!NEF_AddBlankField(packet, info, NTP_EF_NTS_COOKIE_PLACEHOLDER,
+                           cookie->length, &ef_body))
       return 0;
+    memset(ef_body, 0, cookie->length);
   }
 
   if (!NNA_GenerateAuthEF(packet, info, inst->siv_c2s, inst->nonce, sizeof (inst->nonce),