]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
nts: don't load zero-length keys with unsupported algorithm
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 29 May 2023 12:12:54 +0000 (14:12 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 29 May 2023 14:08:13 +0000 (16:08 +0200)
Don't load keys and cookies from the client's dump file if it has an
unsupported algorithm and unparseable keys (matching the algorithm's
expected length of zero). They would fail all SIV operations and trigger
new NTS-KE session.

nts_ntp_client.c

index 10cf0712205d2a3a0a8e536c9ca063a5d3ff7801..2f4b72835c89eeec0cbe56da73f02be78230d93c 100644 (file)
@@ -650,6 +650,7 @@ load_cookies(NNC_Instance inst)
                                             sizeof (inst->context.c2s.key));
 
   if (inst->context.s2c.length != SIV_GetKeyLength(algorithm) ||
+      inst->context.s2c.length <= 0 ||
       inst->context.c2s.length != inst->context.s2c.length)
     goto error;