rcinput: avoid theoretically possible timerid overflow

Origin commit data
------------------
Branch: ni/coolstream
Commit: 081e35b3e5
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2013-12-22 (Sun, 22 Dec 2013)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Stefan Seyfried
2013-12-22 22:23:41 +01:00
committed by Jacek Jendrzej
parent 784fabca91
commit fc478d0ee1

View File

@@ -350,6 +350,11 @@ int CRCInput::addTimer(uint64_t Interval, bool oneshot, bool correct_time )
_newtimer.interval = 0; _newtimer.interval = 0;
_newtimer.id = timerid++; _newtimer.id = timerid++;
/* in theory, this uint32_t could overflow... */
/* ...and timerid == 0 is used as "no timer" in many places. */
if (timerid == 0)
timerid++;
if ( correct_time ) if ( correct_time )
_newtimer.times_out = timeNow+ Interval; _newtimer.times_out = timeNow+ Interval;
else else