ntp: clamp remote stratum

Don't set the remote stratum (used for polling adjustments) to values
larger than 16.
This commit is contained in:
Miroslav Lichvar 2021-04-14 12:36:28 +02:00
parent 81f7f6ddf0
commit 635a9d3f5a

View 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;