]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
ntp: clamp remote stratum
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 14 Apr 2021 10:36:28 +0000 (12:36 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 15 Apr 2021 13:17:13 +0000 (15:17 +0200)
Don't set the remote stratum (used for polling adjustments) to values
larger than 16.

ntp_core.c

index 374233296b8261e4d8c24186a2398d215c48567e..51c11fd158f7b97de3e68edad732d82890ea0604 100644 (file)
@@ -1759,7 +1759,7 @@ process_response(NCR_Instance inst, NTP_Local_Address *local_addr,
   if (valid_packet) {
     inst->remote_poll = message->poll;
     inst->remote_stratum = message->stratum != NTP_INVALID_STRATUM ?
-                           message->stratum : NTP_MAX_STRATUM;
+                           MIN(message->stratum, NTP_MAX_STRATUM) : NTP_MAX_STRATUM;
 
     inst->prev_local_poll = inst->local_poll;
     inst->prev_tx_count = inst->tx_count;