]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
nts: reset packet length after failed auth encryption
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 21 Sep 2020 13:29:37 +0000 (15:29 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 23 Sep 2020 13:10:43 +0000 (15:10 +0200)
If encryption of the NTS authenticator field fails, don't leave
uninitialized data in the packet in case a bug causes the packet to be
sent.

nts_ntp_auth.c

index 7580377c7cb5a5404d61d68139f7905876ebe951..ac0763e0173a9d438794c40bad5febd469ac435b 100644 (file)
@@ -112,6 +112,7 @@ NNA_GenerateAuthEF(NTP_Packet *packet, NTP_PacketInfo *info, SIV_Instance siv,
   if (!SIV_Encrypt(siv, nonce, nonce_length, packet, assoc_length,
                    plaintext, plaintext_length, ciphertext, ciphertext_length)) {
     DEBUG_LOG("SIV encrypt failed");
+    info->length = assoc_length;
     return 0;
   }