Re: [PATCH] ntp: remove accidental integer wrap-around

From: Justin Stitt
Date: Thu May 16 2024 - 19:55:40 EST


On Thu, May 16, 2024 at 4:40 PM Justin Stitt <justinstitt@xxxxxxxxxx> wrote:
> Isn't this usually supplied from the user and can be some pretty
> random stuff? Are you suggesting we update
> timekeeping_validate_timex() to include a check to limit the maxerror
> field to (NTP_PHASE_LIMIT-(MAXFREQ / NSEC_PER_USEC))? It seems like we
> should handle the overflow case where it happens: in
> second_overflow().

Or, I suppose we could add a check to timekeeping_validate_timex() like:

if (txc->modes & ADJ_MAXERROR) {
if (txc->maxerror < 0 || txc->maxerror > NTP_PHASE_LIMIT)
return -EINVAL;
}


> Thanks
> Justin