On Mon, May 02, 2016 at 07:07:49PM +0200, Toke Høiland-Jørgensen wrote: > Intervals are carried as 16-bit centisecond values, but kept internally > in 16-bit second values, which causes a potential for overflow. This > adds some checks to make sure this doesn't happen. > > + /* make sure we don't overflow the 16-bit centisec fields */ > if (!BABEL_IFACE->update_interval) > - BABEL_IFACE->update_interval = > BABEL_IFACE->hello_interval*BABEL_UPDATE_INTERVAL_FACTOR; > - BABEL_IFACE->ihu_interval = > BABEL_IFACE->hello_interval*BABEL_IHU_INTERVAL_FACTOR; > + BABEL_IFACE->update_interval = > MIN_(BABEL_IFACE->hello_interval*BABEL_UPDATE_INTERVAL_FACTOR, > BABEL_MAX_INTERVAL); > + BABEL_IFACE->ihu_interval = > MIN_(BABEL_IFACE->hello_interval*BABEL_IHU_INTERVAL_FACTOR, > BABEL_MAX_INTERVAL);
This is not completely correct, because IHU interval is not independent of hello_interval in this implementation - IHUs are sent for each BABEL_IHU_INTERVAL_FACTOR hellos even if ihu_interval is limited by this. -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: [email protected]) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
